class VoucherSubTypeController {

    @PostMapping("/_search")
    @ResponseBody
    @ResponseStatus(HttpStatus.OK)
    public VoucherSubTypeResponse search(@ModelAttribute VoucherSubTypeSearchContract voucherSubTypeSearchContract,
            RequestInfo requestInfo,
            BindingResult errors) {

        ModelMapper mapper = new ModelMapper();
        VoucherSubTypeSearch domain = new VoucherSubTypeSearch();
        mapper.map(voucherSubTypeSearchContract, domain);
        VoucherSubTypeContract contract;
        ModelMapper model = new ModelMapper();
        List<VoucherSubTypeContract> voucherSubTypeContracts = new ArrayList<>();
        Pagination<VoucherSubType> voucherSubTypes = voucherSubTypeService.search(domain);

        if (voucherSubTypes.getPagedData() != null) {
            for (VoucherSubType voucherSubType : voucherSubTypes.getPagedData()) {
                contract = new VoucherSubTypeContract();
                model.map(voucherSubType, contract);
                voucherSubTypeContracts.add(contract);
            }
        }

        VoucherSubTypeResponse response = new VoucherSubTypeResponse();
        response.setVoucherSubTypes(voucherSubTypeContracts);
        response.setPage(new PaginationContract(voucherSubTypes));
        response.setResponseInfo(getResponseInfo(requestInfo));

        return response;

    }

}