class ApplicationResearchCategoryModelPopulator extends AbstractLeadOnlyModelPopulator {

    public ResearchCategoryViewModel populate(ApplicationResource applicationResource,
                                              long loggedInUserId,
                                              Long questionId) {
        boolean hasApplicationFinances = hasApplicationFinances(applicationResource);

        boolean userIsLeadApplicant = userService.isLeadApplicant(loggedInUserId, applicationResource);
        boolean complete = isComplete(applicationResource, loggedInUserId, QuestionSetupType.RESEARCH_CATEGORY);
        boolean allReadonly = !userIsLeadApplicant || complete;

        String researchCategoryName = Optional.of(applicationResource.getResearchCategory())
                .map(ResearchCategoryResource::getName).orElse(null);

        return new ResearchCategoryViewModel(applicationResource.getName(),
                applicationResource.getId(),
                applicationResource.getCompetitionName(),
                questionId,
                getResearchCategories(applicationResource.getCompetition()),
                hasApplicationFinances,
                researchCategoryName,
                isApplicationSubmitted(applicationResource) || !isCompetitionOpen(applicationResource),
                complete,
                userIsLeadApplicant,
                allReadonly,
                userIsLeadApplicant,
                getLeadApplicantName(applicationResource.getId()));
    }

    public  ApplicationResearchCategoryModelPopulator(final ApplicantRestService applicantRestService,
                                                     final CompetitionResearchCategoryRestService competitionResearchCategoryRestService,
                                                     final FinanceService financeService,
                                                     final QuestionRestService questionRestService,
                                                     final UserService userService,
                                                     final UserRestService userRestService);

}