package com.qmth.teachcloud.eds.entity;

import com.baomidou.mybatisplus.annotation.TableField;
import com.qmth.teachcloud.eds.vo.SubjectiveScorePK;

import java.io.Serializable;

/**
 * 主观题得分详情状态
 */
public class SubjectiveScore implements Serializable, Comparable<SubjectiveScore> {

    private static final long serialVersionUID = 6637010422161820147L;

    private SubjectiveScorePK pk;

    /**
     * 考试ID
     */
    @TableField(value = "exam_id")
    private Integer examId;

    /**
     * 科目代码
     */
    @TableField(value = "subject_code")
    private String subjectCode;

    /**
     * 分组序号
     */
    @TableField(value = "group_number")
    private Integer groupNumber;

    /**
     * 分组总分
     */
    @TableField(value = "group_score")
    private Double groupScore;

    /**
     * 大题总分
     */
    @TableField(value = "main_score")
    private Double mainScore;

    /**
     * 小题得分
     */
    @TableField(value = "score")
    private Double score;

    /**
     * 未作答的步骤数量
     */
    @TableField(value = "unanswered_count")
    private Integer unansweredCount;

    /**
     * 未计分
     */
    @TableField(value = "uncalculate")
    private Boolean uncalculate;

    /**
     * 未计分
     */
    @TableField(value = "rejected")
    private Boolean rejected;

    public SubjectiveScore() {
        this.pk = new SubjectiveScorePK();
    }

    public Integer getStudentId() {
        return pk.getStudentId();
    }

    public void setStudentId(Integer studentId) {
        this.pk.setStudentId(studentId);
    }

    public Integer getMainNumber() {
        return pk.getMainNumber();
    }

    public void setMainNumber(Integer mainNumber) {
        this.pk.setMainNumber(mainNumber);
    }

    public String getSubNumber() {
        return pk.getSubNumber();
    }

    public void setSubNumber(String subNumber) {
        this.pk.setSubNumber(subNumber);
    }

    public Integer getExamId() {
        return examId;
    }

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

    public String getSubjectCode() {
        return subjectCode;
    }

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

    public Integer getGroupNumber() {
        return groupNumber;
    }

    public void setGroupNumber(Integer groupNumber) {
        this.groupNumber = groupNumber;
    }

    public Double getGroupScore() {
        return groupScore;
    }

    public void setGroupScore(Double groupScore) {
        this.groupScore = groupScore;
    }

    public Double getScore() {
        return score;
    }

    public void setScore(Double score) {
        this.score = score;
    }

    public Double getMainScore() {
        return mainScore;
    }

    public void setMainScore(Double mainScore) {
        this.mainScore = mainScore;
    }

    public Integer getUnansweredCount() {
        return unansweredCount;
    }

    public void setUnansweredCount(Integer unansweredCount) {
        this.unansweredCount = unansweredCount;
    }

    @Override
    public int compareTo(SubjectiveScore other) {
        int i = this.getMainNumber() - other.getMainNumber();
        if (i == 0) {
            if (this.getSubNumber().contains("-")) {
                String[] o1s = this.getSubNumber().split("-");
                String[] o2s = other.getSubNumber().split("-");
                int j = Integer.parseUnsignedInt(o1s[0]) - Integer.parseUnsignedInt(o2s[0]);
                if (j == 0) {
                    return Integer.parseUnsignedInt(o1s[1]) - Integer.parseUnsignedInt(o2s[1]);
                } else {
                    return j;
                }
            } else {
                return Integer.parseUnsignedInt(this.getSubNumber()) - Integer.parseUnsignedInt(other.getSubNumber());
            }
        }
        return i;
    }

    public Boolean getUncalculate() {
        return uncalculate;
    }

    public void setUncalculate(Boolean uncalculate) {
        this.uncalculate = uncalculate;
    }

    public Boolean getRejected() {
        return rejected;
    }

    public void setRejected(Boolean rejected) {
        this.rejected = rejected;
    }

}
