class SurrenderReasonController {

    @PostMapping("/_search")
    @ResponseBody
    @ResponseStatus(HttpStatus.OK)
    public SurrenderReasonResponse search(@ModelAttribute SurrenderReasonSearchContract surrenderReasonSearchContract,
            RequestInfo requestInfo, BindingResult errors) {

        SurrenderReasonMapper mapper = new SurrenderReasonMapper();
        SurrenderReasonSearch domain = mapper.toSearchDomain(surrenderReasonSearchContract);
        SurrenderReasonContract contract;
        List<SurrenderReasonContract> surrenderReasonContracts = new ArrayList<>();
        Pagination<SurrenderReason> surrenderreasons = surrenderReasonService.search(domain);

        if (surrenderreasons.getPagedData() != null)
            for (SurrenderReason surrenderReason : surrenderreasons.getPagedData()) {
                contract = mapper.toContract(surrenderReason);
                surrenderReasonContracts.add(contract);
            }

        SurrenderReasonResponse response = new SurrenderReasonResponse();
        response.setSurrenderReasons(surrenderReasonContracts);
        response.setPage(new PaginationContract(surrenderreasons));
        response.setResponseInfo(getResponseInfo(requestInfo));

        return response;

    }

}