class GrantAgreementViewModelPopulator {

    public GrantAgreementViewModel populate(long applicationId, long questionId, long userId) {
        ApplicationResource application = applicationRestService.getApplicationById(applicationId).getSuccess();
        CompetitionResource competition = competitionRestService.getCompetitionById(application.getCompetition()).getSuccess();
        Optional<FileEntryResource> file = euGrantTransferRestService.findGrantAgreement(applicationId).getOptionalSuccessObject();
        OrganisationResource organisation = organisationRestService.getByUserAndApplicationId(userId, applicationId).getSuccess();
        boolean complete = isComplete(application, organisation, questionId);
        boolean open = application.isOpen() && competition.isOpen();
        return new GrantAgreementViewModel(application.getId(), competition.getName(), application.getName(), questionId, file.map(FileEntryResource::getName).orElse(null),
                open, complete);
    }

    public  GrantAgreementViewModelPopulator(ApplicationRestService applicationRestService, EuGrantTransferRestService euGrantTransferRestService, QuestionStatusRestService questionStatusRestService, OrganisationRestService organisationRestService, CompetitionRestService competitionRestService);

}