class CompetitionSetupInnovationLeadController {

    @PreAuthorize("hasPermission(#competitionId, 'org.innovateuk.ifs.competition.resource.CompetitionCompositeId', 'MANAGE_INNOVATION_LEAD')")
    @PostMapping("/{competitionId}/add-innovation-lead/{innovationLeadUserId}")
    public String addInnovationLead(@PathVariable(COMPETITION_ID_KEY) long competitionId,
                                    @PathVariable("innovationLeadUserId") long innovationLeadUserId,
                                    Model model) {

        CompetitionResource competition = competitionRestService.getCompetitionById(competitionId).getSuccess();

        if (!competitionSetupService.hasInitialDetailsBeenPreviouslySubmitted(competitionId)) {
            return "redirect:/competition/setup/" + competitionId;
        }

        return competitionSetupInnovationLeadService.addInnovationLead(competitionId, innovationLeadUserId).handleSuccessOrFailure(
                failure -> "redirect:/competition/manage-innovation-leads/find",
                success -> {
                    model.addAttribute(MODEL, manageInnovationLeadsModelPopulator.populateModel(competition));
                    return "competition/manage-innovation-leads-find";
                }
        );
    }

}