class MonitoringOfficerRegistrationController {

    @GetMapping(value = "/{inviteHash}/register/account-created")
    public String accountCreated(@PathVariable("inviteHash") String inviteHash, HttpServletRequest request, UserResource loggedInUser) {
        boolean userIsLoggedIn = loggedInUser != null;

        if (userIsLoggedIn) {
            return dashboardRedirect(request);
        }

        return competitionSetupMonitoringOfficerRestService.getMonitoringOfficerInvite(inviteHash).andOnSuccessReturn(invite -> {
            if (InviteStatus.OPENED != invite.getStatus()) {
                return format("redirect:/monitoring-officer/%s/register", inviteHash);
            } else {
                return "registration/account-created";
            }
        }).getSuccess();
    }

}