class SurrenderReasonContractRepository {

    public SurrenderReasonContract findById(SurrenderReasonContract surrenderReasonContract) {

        String url = String.format("%s%s", hostUrl, SEARCH_URL);
        StringBuffer content = new StringBuffer();
        if (surrenderReasonContract.getId() != null)
            content.append("id=" + surrenderReasonContract.getId());

        if (surrenderReasonContract.getTenantId() != null)
            content.append("&tenantId=" + surrenderReasonContract.getTenantId());
        url = url + content.toString();
        SurrenderReasonResponse result = restTemplate.postForObject(url, null, SurrenderReasonResponse.class);

        if (result.getSurrenderReasons() != null && result.getSurrenderReasons().size() == 1)
            return result.getSurrenderReasons().get(0);
        else
            return null;

    }

    public  SurrenderReasonContractRepository(@Value("${egf.instrument.host.url}") String hostUrl,
            RestTemplate restTemplate);

}