class NonIfsDetailsFormPopulator {

    public NonIfsDetailsForm populate(CompetitionResource competitionResource) {
        NonIfsDetailsForm form = new NonIfsDetailsForm();
        form.setTitle(competitionResource.getName());
        form.setInnovationSectorCategoryId(competitionResource.getInnovationSector());
        form.setInnovationAreaCategoryId(competitionResource.getInnovationAreas().stream().findAny().orElse(null));
        form.setUrl(competitionResource.getNonIfsUrl());
        form.setApplicantNotifiedDate(new MilestoneOrEmptyRowForm(MilestoneType.NOTIFICATIONS, competitionResource.getFundersPanelEndDate()));
        form.setRegistrationCloseDate(new MilestoneRowForm(MilestoneType.REGISTRATION_DATE, competitionResource.getRegistrationDate()));
        form.setOpenDate(new MilestoneRowForm(MilestoneType.OPEN_DATE, competitionResource.getStartDate()));
        form.setCloseDate(new MilestoneRowForm(MilestoneType.SUBMISSION_DATE, competitionResource.getEndDate()));
        form.setFundingType(competitionResource.getFundingType());
        return form;
    }

}