class AssessorManagementController {

    @GetMapping("/status")
    public String viewStatus(@ModelAttribute(name = "form") ChangeRoleProfileForm form,
                             @PathVariable long userId,
                             Model model) {

        RoleProfileStatusResource roleProfileStatus = getRoleProfileViewModel(userId).getRoleProfileStatus();

        if (form.getRoleProfileState() == null) {

            form.setRoleProfileState(roleProfileStatus.getRoleProfileState());
            
            if (form.getRoleProfileState() == UNAVAILABLE) {
                form.setUnavailableReason(roleProfileStatus.getDescription());
            }
            if (form.getRoleProfileState() == DISABLED) {
                form.setDisabledReason(roleProfileStatus.getDescription());
            }
        }

        model.addAttribute("state", roleProfileStatus.getRoleProfileState().getDescription().toLowerCase());
        model.addAttribute("userId", userId);
        return "roleprofile/change-status";
    }

}