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

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

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

    @ApiModelProperty(value = "客观题分数")
    private Double objectiveScore;

    public StudentObjectiveScoreParams() {

    }

    public StudentObjectiveScoreParams(Long orgId, Long examId, String examNumber, Double objectiveScore) {
        super(orgId, null, null);
        this.examId = examId;
        this.examNumber = examNumber;
        this.objectiveScore = objectiveScore;
    }

    public StudentObjectiveScoreParams(Long orgId, Long examId, String examNumber, Double objectiveScore
            , String accessKey, String accessSecret) {
        super(orgId, accessKey, accessSecret);
        this.examId = examId;
        this.examNumber = examNumber;
        this.objectiveScore = objectiveScore;
    }

    public void vaildParams() {
        if (Objects.isNull(this.examId)) {
            throw new BusinessException("云阅卷考试id不能为空");
        }
        if (Objects.isNull(this.examNumber)) {
            throw new BusinessException("准考证号不能为空");
        }
        if (Objects.isNull(this.objectiveScore)) {
            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 Double getObjectiveScore() {
        return objectiveScore;
    }

    public void setObjectiveScore(Double objectiveScore) {
        this.objectiveScore = objectiveScore;
    }
}
