package com.qmth.teachcloud.report.business.bean.params;

import com.qmth.teachcloud.common.enums.ExceptionResultEnum;
import com.qmth.teachcloud.common.enums.RoleTypeEnum;
import io.swagger.annotations.ApiModelProperty;

import java.io.Serializable;
import java.util.Optional;

/**
 * @Description: 课程参数
 * @Param:
 * @return:
 * @Author: wangliang
 * @Date: 2022/5/27
 */
public class LoginThirdParam implements Serializable {

    @ApiModelProperty(value = "登录名")
    private String loginName;

    @ApiModelProperty(value = "角色枚举")
    private RoleTypeEnum role;

    @ApiModelProperty(value = "真实名")
    private String realName;

    @ApiModelProperty(value = "手机号码")
    private String mobileNumber;

    @ApiModelProperty(value = "学院名称")
    private String orgName;

    @ApiModelProperty(value = "启用/禁用，ture：启用，false：禁用")
    private Boolean enable;

    @ApiModelProperty(value = "返回url")
    private String returnUrl;

    /**
     * 参数校验
     */
    public void validParams() {
        Optional.ofNullable(this.getLoginName()).orElseThrow(() -> ExceptionResultEnum.PARAMS_ERROR.exception("登录名为空"));
        Optional.ofNullable(this.getRole()).orElseThrow(() -> ExceptionResultEnum.PARAMS_ERROR.exception("角色为空"));
        Optional.ofNullable(this.getReturnUrl()).orElseThrow(() -> ExceptionResultEnum.PARAMS_ERROR.exception("返回url为空"));
        Optional.ofNullable(this.getOrgName()).orElseThrow(() -> ExceptionResultEnum.PARAMS_ERROR.exception("学院名称为空"));
    }

    public Boolean getEnable() {
        return enable;
    }

    public void setEnable(Boolean enable) {
        this.enable = enable;
    }

    public String getOrgName() {
        return orgName;
    }

    public void setOrgName(String orgName) {
        this.orgName = orgName;
    }

    public String getLoginName() {
        return loginName;
    }

    public void setLoginName(String loginName) {
        this.loginName = loginName;
    }

    public RoleTypeEnum getRole() {
        return role;
    }

    public void setRole(RoleTypeEnum role) {
        this.role = role;
    }

    public String getRealName() {
        return realName;
    }

    public void setRealName(String realName) {
        this.realName = realName;
    }

    public String getMobileNumber() {
        return mobileNumber;
    }

    public void setMobileNumber(String mobileNumber) {
        this.mobileNumber = mobileNumber;
    }

    public String getReturnUrl() {
        return returnUrl;
    }

    public void setReturnUrl(String returnUrl) {
        this.returnUrl = returnUrl;
    }
}
