class AccountDetailKeyController {

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

		ModelMapper mapper = new ModelMapper();
		AccountDetailKeySearch domain = new AccountDetailKeySearch();
		mapper.map(accountDetailKeySearchContract, domain);
		AccountDetailKeyContract contract;
		ModelMapper model = new ModelMapper();
		List<AccountDetailKeyContract> accountDetailKeyContracts = new ArrayList<>();
		Pagination<AccountDetailKey> accountdetailkeys = accountDetailKeyService.search(domain, errors);

		for (AccountDetailKey accountDetailKey : accountdetailkeys.getPagedData()) {
			contract = new AccountDetailKeyContract();
			model.map(accountDetailKey, contract);
			accountDetailKeyContracts.add(contract);
		}

		AccountDetailKeyResponse response = new AccountDetailKeyResponse();
		response.setAccountDetailKeys(accountDetailKeyContracts);
		response.setPage(new PaginationContract(accountdetailkeys));
		response.setResponseInfo(getResponseInfo(requestInfo));

		return response;

	}

}