class AssessorCompetitionDashboardModelPopulator {

    public AssessorCompetitionDashboardViewModel populateModel(Long competitionId, Long userId) {

        AssessorCompetitionDashboardResource assessorCompetitionDashboard = assessorCompetitionDashboardRestService.getAssessorCompetitionDashboard(competitionId, userId).getSuccess();

        List<AssessorCompetitionDashboardApplicationViewModel> outstanding = getOutstandingAssessments(assessorCompetitionDashboard.getApplicationAssessments());
        List<AssessorCompetitionDashboardApplicationViewModel> submitted = getSubmittedAssessments(assessorCompetitionDashboard.getApplicationAssessments());

        boolean submitVisible = outstanding.stream()
                .anyMatch(AssessorCompetitionDashboardApplicationViewModel::isReadyToSubmit);

        return new AssessorCompetitionDashboardViewModel(
                assessorCompetitionDashboard.getCompetitionId(),
                assessorCompetitionDashboard.getCompetitionName(),
                assessorCompetitionDashboard.getInnovationLead(),
                assessorCompetitionDashboard.getAssessorAcceptDate(),
                assessorCompetitionDashboard.getAssessorDeadlineDate(),
                submitted,
                outstanding,
                submitVisible
        );
    }

}