class FunctionRepository {

	public Pagination<Function> search(FunctionSearch domain) {
		if (!financialConfigurationService.fetchDataFrom().isEmpty()
				&& financialConfigurationService.fetchDataFrom().equalsIgnoreCase("es")) {
			FunctionSearchContract functionSearchContract = new FunctionSearchContract();
			ModelMapper mapper = new ModelMapper();
			mapper.map(domain, functionSearchContract);
			return functionESRepository.search(functionSearchContract);
		} else {
			return functionJdbcRepository.search(domain);
		}

	}

	@Autowired public  FunctionRepository(FunctionJdbcRepository functionJdbcRepository,
			MastersQueueRepository functionQueueRepository, FinancialConfigurationService financialConfigurationService,
			FunctionESRepository functionESRepository, @Value("${persist.through.kafka}") String persistThroughKafka);

}