class DocumentsController {

    @PreAuthorize("hasPermission(#projectId, 'org.innovateuk.ifs.project.resource.ProjectCompositeId', 'APPROVE_DOCUMENTS')")
	@PostMapping("/config/{documentConfigId}")
    public String documentDecision(@PathVariable("projectId") long projectId,
                                   @PathVariable("documentConfigId") long documentConfigId,
                                   @ModelAttribute(FORM_ATTR) DocumentForm form,
                                   @SuppressWarnings("unused") BindingResult bindingResult,
                                   ValidationHandler validationHandler,
                                   Model model,
                                   UserResource loggedInUser) {

        Supplier<String> successView = () -> redirectToViewDocumentPage(projectId, documentConfigId);
        Supplier<String> failureView = () -> doViewDocument(projectId, loggedInUser.getId(), documentConfigId, model, form);

        RestResult<Void> result = documentsRestService.documentDecision(projectId, documentConfigId,
                new ProjectDocumentDecision(form.getApproved(), form.getRejectionReason()));

        return validationHandler.addAnyErrors(result, asGlobalErrors()).
                failNowOrSucceedWith(failureView, successView);
    }

    public  DocumentsController();
    @Autowired public  DocumentsController(DocumentsPopulator populator, DocumentsRestService documentsRestService);

}