class SurrenderReasonRepository {

    public Pagination<SurrenderReason> search(SurrenderReasonSearch domain) {

        if (financialConfigurationContractRepository.fetchDataFrom() != null
                && financialConfigurationContractRepository.fetchDataFrom().equalsIgnoreCase("es")) {

            SurrenderReasonMapper mapper = new SurrenderReasonMapper();
            SurrenderReasonSearchContract surrenderReasonSearchContract = new SurrenderReasonSearchContract();
            surrenderReasonSearchContract = mapper.toSearchContract(domain);

            return surrenderReasonESRepository.search(surrenderReasonSearchContract);

        } else
            return surrenderReasonJdbcRepository.search(domain);

    }

    @Autowired public  SurrenderReasonRepository(SurrenderReasonJdbcRepository surrenderReasonJdbcRepository,
            SurrenderReasonQueueRepository surrenderReasonQueueRepository,
            @Value("${persist.through.kafka}") String persistThroughKafka,
            FinancialConfigurationContractRepository financialConfigurationContractRepository,
            SurrenderReasonESRepository surrenderReasonESRepository);

}