class GrantTransferDetailsController {

    @PostMapping(params = "complete")
    public String markAsComplete(@ModelAttribute(name = MODEL_ATTRIBUTE_FORM) @Valid GrantTransferDetailsForm form,
                                 @SuppressWarnings("unused") BindingResult bindingResult,
                                 ValidationHandler validationHandler,
                                 Model model,
                                 @PathVariable long applicationId,
                                 @PathVariable long questionId,
                                 UserResource user) {
        Supplier<String> failureView = () -> view(model, applicationId, questionId, user);
        return validationHandler.failNowOrSucceedWith(failureView, () -> {
            validationHandler.addAnyErrors(grantTransferDetailsSaver.save(form, applicationId).getErrors());
            return validationHandler.failNowOrSucceedWith(failureView, () -> {
                ProcessRoleResource role = userRestService.findProcessRole(user.getId(), applicationId).getSuccess();
                questionStatusRestService.markAsComplete(questionId, applicationId, role.getId()).getSuccess();
                return String.format("redirect:/application/%d/form/question/%d/grant-transfer-details", applicationId, questionId);
            });
        });
    }

    public  GrantTransferDetailsController(GrantTransferDetailsFormPopulator grantTransferDetailsFormPopulator, GrantTransferDetailsViewModelPopulator grantTransferDetailsViewModelPopulator, GrantTransferDetailsSaver grantTransferDetailsSaver, UserRestService userRestService, QuestionStatusRestService questionStatusRestService);

}