class BudgetRepository {

    public Pagination<Budget> search(final BudgetSearch domain) {
        if (financialConfigurationContractRepository.fetchDataFrom() != null
                && financialConfigurationContractRepository.fetchDataFrom().equalsIgnoreCase("es")) {

            BudgetMapper mapper = new BudgetMapper();
            BudgetSearchContract budgetSearchContract = new BudgetSearchContract();
            budgetSearchContract = mapper.toSearchContract(domain);
            Pagination<Budget> budgets = budgetESRepository.search(budgetSearchContract);
            return budgets;
        } else {

            return budgetJdbcRepository.search(domain);
        }

    }

    @Autowired public  BudgetRepository(BudgetJdbcRepository budgetJdbcRepository, BudgetQueueRepository budgetQueueRepository,
                            @Value("${persist.through.kafka}") String persistThroughKafka,FinancialConfigurationContractRepository financialConfigurationContractRepository,
                            BudgetESRepository budgetESRepository);

}