package com.qmth.themis.business.bean.cloudmark;

import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import com.qmth.themis.common.exception.BusinessException;
import io.swagger.annotations.ApiModelProperty;

import java.io.Serializable;
import java.util.Objects;

/**
 * @Description: 推送云阅卷学生接口参数
 * @Param:
 * @return:
 * @Author: wangliang
 * @Date: 2022/9/28
 */
public class SaveStudentParams extends BaseParams implements Serializable {

    @ApiModelProperty(value = "云阅卷考试id")
    @JsonSerialize(using = ToStringSerializer.class)
    private Long examId;

    @ApiModelProperty(value = "准考证号")
    private String examNumber;

    @ApiModelProperty(value = "学号")
    private String studentCode;

    @ApiModelProperty(value = "姓名")
    private String name;

    @ApiModelProperty(value = "学院")
    private String college;

    @ApiModelProperty(value = "班级名称")
    private String className;

    @ApiModelProperty(value = "教师姓名")
    private String teacher;

    @ApiModelProperty(value = "科目代码")
    private String subjectCode;

    @ApiModelProperty(value = "科目名称")
    private String subjectName;

    @ApiModelProperty(value = "签到表编号")
    private String packageCode;

    @ApiModelProperty(value = "试卷类型")
    private String paperType;

    @ApiModelProperty(value = "考点")
    private String examSite;

    @ApiModelProperty(value = "考场")
    private String examRoom;

    public SaveStudentParams() {

    }

    public SaveStudentParams(Long orgId, Long examId, String examNumber, String studentCode, String name, String college,
                             String className, String teacher, String subjectCode, String subjectName) {
        super(orgId, null, null);
        this.examId = examId;
        this.examNumber = examNumber;
        this.studentCode = studentCode;
        this.name = name;
        this.college = college;
        this.className = className;
        this.teacher = teacher;
        this.subjectCode = subjectCode;
        this.subjectName = subjectName;
    }

    public SaveStudentParams(Long orgId, Long examId, String examNumber, String studentCode, String name, String college,
                             String className, String teacher, String subjectCode, String subjectName,
                             String accessKey, String accessSecret) {
        super(orgId, accessKey, accessSecret);
        this.examId = examId;
        this.examNumber = examNumber;
        this.studentCode = studentCode;
        this.name = name;
        this.college = college;
        this.className = className;
        this.teacher = teacher;
        this.subjectCode = subjectCode;
        this.subjectName = subjectName;
    }

    public void vaildParams() {
        if (Objects.isNull(this.examId)) {
            throw new BusinessException("云阅卷考试id不能为空");
        }
        if (Objects.isNull(this.examNumber)) {
            throw new BusinessException("准考证号不能为空");
        }
        if (Objects.isNull(this.studentCode)) {
            throw new BusinessException("学号不能为空");
        }
        if (Objects.isNull(this.name)) {
            throw new BusinessException("姓名不能为空");
        }
        if (Objects.isNull(this.college)) {
            throw new BusinessException("学院不能为空");
        }
        if (Objects.isNull(this.className)) {
            throw new BusinessException("班级名称不能为空");
        }
        if (Objects.isNull(this.teacher)) {
            throw new BusinessException("教师不能为空");
        }
        if (Objects.isNull(this.subjectCode)) {
            throw new BusinessException("科目编码不能为空");
        }
        if (Objects.isNull(this.subjectName)) {
            throw new BusinessException("科目名称不能为空");
        }
    }

    public Long getExamId() {
        return examId;
    }

    public void setExamId(Long examId) {
        this.examId = examId;
    }

    public String getExamNumber() {
        return examNumber;
    }

    public void setExamNumber(String examNumber) {
        this.examNumber = examNumber;
    }

    public String getStudentCode() {
        return studentCode;
    }

    public void setStudentCode(String studentCode) {
        this.studentCode = studentCode;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getCollege() {
        return college;
    }

    public void setCollege(String college) {
        this.college = college;
    }

    public String getClassName() {
        return className;
    }

    public void setClassName(String className) {
        this.className = className;
    }

    public String getTeacher() {
        return teacher;
    }

    public void setTeacher(String teacher) {
        this.teacher = teacher;
    }

    public String getSubjectCode() {
        return subjectCode;
    }

    public void setSubjectCode(String subjectCode) {
        this.subjectCode = subjectCode;
    }

    public String getSubjectName() {
        return subjectName;
    }

    public void setSubjectName(String subjectName) {
        this.subjectName = subjectName;
    }

    public String getPackageCode() {
        return packageCode;
    }

    public void setPackageCode(String packageCode) {
        this.packageCode = packageCode;
    }

    public String getPaperType() {
        return paperType;
    }

    public void setPaperType(String paperType) {
        this.paperType = paperType;
    }

    public String getExamSite() {
        return examSite;
    }

    public void setExamSite(String examSite) {
        this.examSite = examSite;
    }

    public String getExamRoom() {
        return examRoom;
    }

    public void setExamRoom(String examRoom) {
        this.examRoom = examRoom;
    }
}
