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 StudentScoreParams extends BaseParams implements Serializable {

    @ApiModelProperty(value = "考试批次id")
    @JsonSerialize(using = ToStringSerializer.class)
    Long examId;

    @ApiModelProperty(value = "考试批次编码")
    String examCode;

    public StudentScoreParams() {

    }

    public StudentScoreParams(Long orgId, Long examId, String examCode) {
        super(orgId, null, null);
        this.examId = examId;
        this.examCode = examCode;
    }

    public StudentScoreParams(Long orgId, Long examId, String examCode, String accessKey, String accessSecret) {
        super(orgId, accessKey, accessSecret);
        this.examId = examId;
        this.examCode = examCode;
    }

    /**
     * 校验参数
     */
    public void vaildParams() {
        if (Objects.isNull(this.examId) && Objects.isNull(this.examCode)) {
            throw new BusinessException("examId或examCode必填一个");
        }
        this.examCode = null;
    }

    public Long getExamId() {
        return examId;
    }

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

    public String getExamCode() {
        return examCode;
    }

    public void setExamCode(String examCode) {
        this.examCode = examCode;
    }
}
