class DocumentsServiceImpl extends AbstractProjectServiceImpl implements DocumentsService {

    @Override
    @Transactional
    public ServiceResult<Void> documentDecision(long projectId, long documentConfigId, ProjectDocumentDecision decision) {
        return validateProjectDocumentDecision(decision)
                .andOnSuccess(() -> find(getProject(projectId), getCompetitionDocumentConfig(documentConfigId)).
                        andOnSuccess((project, projectDocumentConfig) -> validateProjectActive(project)
                                .andOnSuccess(() -> applyDocumentDecision(project, documentConfigId, decision))
                        )).andOnSuccessReturnVoid(() -> {
                    if (decision.getApproved()) {
                        activityLogService.recordDocumentActivityByProjectId(projectId, ActivityType.DOCUMENT_APPROVED, documentConfigId);
                    } else {
                        activityLogService.recordDocumentActivityByProjectId(projectId, ActivityType.DOCUMENT_REJECTED, documentConfigId);
                    }
                });
    }

}