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

import com.baomidou.mybatisplus.annotation.FieldStrategy;
import com.baomidou.mybatisplus.annotation.TableField;
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 java.io.Serializable;
import java.util.Objects;

/**
 * <p>
 * 试卷蓝图表
 * </p>
 *
 * @author wangliang
 * @since 2024-02-18
 */
@ApiModel(value = "TCPaperStruct对象", description = "试卷蓝图表")
public class TCPaperStruct 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 = "试卷结构")
    @TableField(value = "paper_struct", updateStrategy = FieldStrategy.IGNORED)
    private String paperStruct;

    @ApiModelProperty(value = "试卷知识点结构")
    @TableField(value = "paper_struct_dimension", updateStrategy = FieldStrategy.IGNORED)
    private String paperStructDimension;

    @ApiModelProperty(value = "全卷满分")
    private Double totalScore;

    @ApiModelProperty(value = "及格分")
    private Double passScore;

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

    @JsonSerialize(using = ToStringSerializer.class)
    @ApiModelProperty(value = "权重变化id")
    private Long dimensionSign;

    public TCPaperStruct() {

    }

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

    public TCPaperStruct(Long examId, String courseCode, String courseName, String paperNumber, Long teachCourseId, String paperStruct, Double totalScore, Double passScore, Long userId) {
        insertInfo(userId);
        this.examId = examId;
        this.courseCode = courseCode;
        this.courseName = courseName;
        this.paperNumber = paperNumber;
        this.teachCourseId = teachCourseId;
        this.paperStruct = paperStruct;
        this.totalScore = totalScore;
        this.passScore = passScore;
        this.enable = true;
    }

    public void updateInfo(String paperStructDimension, Long userId) {
        this.paperStructDimension = paperStructDimension;
        updateInfo(userId);
    }

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

    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 Double getTotalScore() {
        return totalScore;
    }

    public void setTotalScore(Double totalScore) {
        this.totalScore = totalScore;
    }

    public Double getPassScore() {
        return passScore;
    }

    public void setPassScore(Double passScore) {
        this.passScore = passScore;
    }

    public Long getDimensionSign() {
        return dimensionSign;
    }

    public void setDimensionSign(Long dimensionSign) {
        this.dimensionSign = dimensionSign;
    }

    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 getPaperStruct() {
        return paperStruct;
    }

    public void setPaperStruct(String paperStruct) {
        this.paperStruct = paperStruct;
    }

    public Boolean getEnable() {
        return enable;
    }

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

    public String getPaperStructDimension() {
        return paperStructDimension;
    }

    public void setPaperStructDimension(String paperStructDimension) {
        this.paperStructDimension = paperStructDimension;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) {
            return true;
        }
        if (o == null || getClass() != o.getClass()) {
            return false;
        }
        TCPaperStruct that = (TCPaperStruct) o;
        return examId.equals(that.examId) && courseCode.equals(that.courseCode) && Objects.equals(courseName, that.courseName) && Objects.equals(paperNumber, that.paperNumber) && teachCourseId.equals(that.teachCourseId) && Objects.equals(paperStruct, that.paperStruct) && Objects.equals(paperStructDimension, that.paperStructDimension) && Objects.equals(getCreateId(), that.getCreateId());
    }

    @Override
    public int hashCode() {
        return Objects.hash(examId, courseCode, courseName, paperNumber, teachCourseId, paperStruct, paperStructDimension, getCreateId());
    }
}
