class ChartOfAccountDetailController {

	@PostMapping("/_search")
	@ResponseBody
	@ResponseStatus(HttpStatus.OK)
	public ChartOfAccountDetailResponse search(
			@ModelAttribute ChartOfAccountDetailSearchContract chartOfAccountDetailSearchContract,
			@RequestBody RequestInfo requestInfo, BindingResult errors,@RequestParam String tenantId) {

		ModelMapper mapper = new ModelMapper();
		ChartOfAccountDetailSearch domain = new ChartOfAccountDetailSearch();
		mapper.map(chartOfAccountDetailSearchContract, domain);
		ChartOfAccountDetailContract contract;
		ModelMapper model = new ModelMapper();
		List<ChartOfAccountDetailContract> chartOfAccountDetailContracts = new ArrayList<>();
		Pagination<ChartOfAccountDetail> chartofaccountdetails = chartOfAccountDetailService.search(domain, errors);

		for (ChartOfAccountDetail chartOfAccountDetail : chartofaccountdetails.getPagedData()) {
			contract = new ChartOfAccountDetailContract();
			model.map(chartOfAccountDetail, contract);
			chartOfAccountDetailContracts.add(contract);
		}

		ChartOfAccountDetailResponse response = new ChartOfAccountDetailResponse();
		response.setChartOfAccountDetails(chartOfAccountDetailContracts);
		response.setPage(new PaginationContract(chartofaccountdetails));
		response.setResponseInfo(getResponseInfo(requestInfo));

		return response;

	}

}