class InstrumentTypeRepository {

    public Pagination<InstrumentType> search(InstrumentTypeSearch domain) {

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

            InstrumentTypeSearchContract instrumentTypeSearchContract = new InstrumentTypeSearchContract();
            InstrumentTypeMapper mapper = new InstrumentTypeMapper();
            instrumentTypeSearchContract = mapper.toSearchContract(domain);
            Pagination<InstrumentType> instrumenttypes = instrumentTypeESRepository
                    .search(instrumentTypeSearchContract);

            return instrumenttypes;

        } else
            return instrumentTypeJdbcRepository.search(domain);

    }

    @Autowired public  InstrumentTypeRepository(InstrumentTypeJdbcRepository instrumentTypeJdbcRepository,
            InstrumentTypeQueueRepository instrumentTypeQueueRepository,
            @Value("${persist.through.kafka}") String persistThroughKafka,
            FinancialConfigurationContractRepository financialConfigurationContractRepository,
            InstrumentTypeESRepository instrumentTypeESRepository);

}