class VoucherSubTypeRepository {

    public Pagination<VoucherSubType> search(VoucherSubTypeSearch domain) {

        if (!financialConfigurationContractRepository.fetchDataFrom().isEmpty()
                && financialConfigurationContractRepository.fetchDataFrom()
                        .equalsIgnoreCase("es")) {
            VoucherSubTypeSearchContract voucherSubTypeSearchContract = new VoucherSubTypeSearchContract();
            ModelMapper mapper = new ModelMapper();
            mapper.map(domain, voucherSubTypeSearchContract);
            return voucherSubTypeESRepository
                    .search(voucherSubTypeSearchContract);
        }

        return voucherSubTypeJdbcRepository.search(domain);

    }

    @Autowired public  VoucherSubTypeRepository(
            VoucherSubTypeJdbcRepository voucherSubTypeJdbcRepository,
            FinancialConfigurationContractRepository financialConfigurationContractRepository,
            VoucherSubTypeESRepository voucherSubTypeESRepository,
            VoucherSubTypeQueueRepository voucherSubTypeQueueRepository,
            @Value("${persist.through.kafka}") String persistThroughKafka);

}