package com.qmth.distributed.print.business.entity;

import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import com.qmth.teachcloud.common.base.BaseEntity;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;

import javax.validation.constraints.NotNull;
import java.io.Serializable;
import java.util.Objects;

/**
 * <p>
 * 平常作业成绩表
 * </p>
 *
 * @author wangliang
 * @since 2024-02-18
 */
@ApiModel(value = "TCUsualScore对象", description = "平常作业成绩表")
public class TCUsualScore extends BaseEntity implements Serializable {

    private static final long serialVersionUID = 1L;

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

    @ApiModelProperty(value = "培养方案id")
    @JsonSerialize(using = ToStringSerializer.class)
    private Long cultureProgramId;

    @ApiModelProperty(value = "课程编码")
    private String courseCode;

    @ApiModelProperty(value = "课程名称")
    private String courseName;

    @ApiModelProperty(value = "试卷编码")
    private String paperNumber;

    @ApiModelProperty(value = "教学课程id")
    @JsonSerialize(using = ToStringSerializer.class)
    private Long teachCourseId;

    @ApiModelProperty(value = "考生姓名")
    @NotNull(message = "考生姓名不能为空")
    private String name;

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

    @ApiModelProperty(value = "平常作业分数")
    @NotNull(message = "平常作业分数不能为空")
    private String score;

    @ApiModelProperty(value = "是否启用，0：停用，1：启用")
    private Boolean enable;

    public TCUsualScore() {

    }

    public TCUsualScore(Long examId, String courseCode, String courseName, String paperNumber, Long obeCourseOutlineId, Long userId) {
        insertInfo(userId);
        this.examId = examId;
        this.courseCode = courseCode;
        this.courseName = courseName;
        this.paperNumber = paperNumber;
        this.teachCourseId = obeCourseOutlineId;
        this.enable = true;
    }

    public void updateInfo(TCUsualScore tcUsualScore, Long userId) {
        updateInfo(userId);
        this.name = tcUsualScore.getName();
        this.score = tcUsualScore.getScore();
    }

    public Long getCultureProgramId() {
        return cultureProgramId;
    }

    public void setCultureProgramId(Long cultureProgramId) {
        this.cultureProgramId = cultureProgramId;
    }

    public Long getTeachCourseId() {
        return teachCourseId;
    }

    public void setTeachCourseId(Long teachCourseId) {
        this.teachCourseId = teachCourseId;
    }

    public Long getExamId() {
        return examId;
    }

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

    public String getCourseCode() {
        return courseCode;
    }

    public void setCourseCode(String courseCode) {
        this.courseCode = courseCode;
    }

    public String getCourseName() {
        return courseName;
    }

    public void setCourseName(String courseName) {
        this.courseName = courseName;
    }

    public String getPaperNumber() {
        return paperNumber;
    }

    public void setPaperNumber(String paperNumber) {
        this.paperNumber = paperNumber;
    }

    public String getName() {
        return name;
    }

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

    public String getStudentCode() {
        return studentCode;
    }

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

    public String getScore() {
        return score;
    }

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

    public Boolean getEnable() {
        return enable;
    }

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

    @Override
    public boolean equals(Object o) {
        if (this == o) {
            return true;
        }
        if (o == null || getClass() != o.getClass()) {
            return false;
        }
        TCUsualScore that = (TCUsualScore) o;
        return examId.equals(that.examId) && courseCode.equals(that.courseCode) && Objects.equals(courseName, that.courseName) && teachCourseId.equals(that.teachCourseId) && name.equals(that.name) && studentCode.equals(that.studentCode) && score.equals(that.score) && enable.equals(that.enable) && Objects.equals(getCreateId(), that.getCreateId());
    }

    @Override
    public int hashCode() {
        return Objects.hash(examId, courseCode, courseName, teachCourseId, name, studentCode, score, enable, getCreateId());
    }
}
