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

import com.baomidou.mybatisplus.annotation.TableField;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import com.qmth.distributed.print.business.bean.result.report.ReportResult;
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;

/**
 * <p>
 * 报告基本情况表
 * </p>
 *
 * @author wangliang
 * @since 2024-02-18
 */
@ApiModel(value = "TRBasicInfo对象", description = "报告基本情况表")
public class TRBasicInfo extends BaseEntity implements Serializable {

    private static final long serialVersionUID = 1L;

    @ApiModelProperty(value = "考试id")
    @JsonSerialize(using = ToStringSerializer.class)
    @NotNull(message = "考试id不能为空")
    private Long examId;

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

    @ApiModelProperty(value = "课程编码")
    @NotNull(message = "课程编码不能为空")
    private String courseCode;

    @ApiModelProperty(value = "课程名称")
    @NotNull(message = "课程名称不能为空")
    private String courseName;

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

    @ApiModelProperty(value = "课程性质")
    private String courseType;

    @ApiModelProperty(value = "学分")
    private String credit;

    @ApiModelProperty(value = "学时")
    private String period;

    @ApiModelProperty(value = "考核方式")
    private String evaluationMode;

    @ApiModelProperty(value = "开课时间")
    private String openTime;

    @ApiModelProperty(value = "授课对象")
    private String teachingObject;

    @ApiModelProperty(value = "选课人数")
    private Integer selectionCount;

    @ApiModelProperty(value = "参评人数")
    private Integer participantCount = 0;

    @ApiModelProperty(value = "课程目标达成度期望值")
    private Double courseDegree;

    @ApiModelProperty(value = "任课老师")
    private String teacher;

    @ApiModelProperty(value = "评价责任人")
    private String director;

    @ApiModelProperty(value = "评价参与人")
    private String participant;

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

    @ApiModelProperty(value = "课程目标考核分布")
    private String courseEvaluationSpread;

    @ApiModelProperty(value = "课程考核成绩评价结果")
    private String courseEvaluationResult;

    @ApiModelProperty(value = "课程考核成绩评价明细结果")
    private String courseEvaluationResultDetail;

    @ApiModelProperty(value = "报告信息")
    @TableField(exist = false)
    private ReportResult reportResult;

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

    public TRBasicInfo() {

    }

    public TRBasicInfo(Long examId, String courseCode, String courseName, String paperNumber, Long teachCourseId, String openTime, String teachingObject, String teacher, Integer participantCount, Long userId) {
        insertInfo(userId);
        this.examId = examId;
        this.courseCode = courseCode;
        this.courseName = courseName;
        this.paperNumber = paperNumber;
        this.teachCourseId = teachCourseId;
        this.openTime = openTime;
        this.teachingObject = teachingObject;
        this.teacher = teacher;
        this.participantCount = participantCount;
        this.enable = true;
        this.reportResult = new ReportResult();
    }

    public TRBasicInfo(TRBasicInfo trBasicInfo, Long userId) {
        insertInfo(userId);
        this.setValue(trBasicInfo);
        this.enable = true;
    }

    public void updateInfo(TRBasicInfo trBasicInfo, Long userId) {
        this.setValue(trBasicInfo);
        updateInfo(userId);
    }

    protected void setValue(TRBasicInfo trBasicInfo) {
        this.examId = trBasicInfo.getExamId();
        this.courseCode = trBasicInfo.getCourseCode();
        this.courseName = trBasicInfo.getCourseName();
        this.paperNumber = trBasicInfo.getPaperNumber();
        this.teachCourseId = trBasicInfo.getTeachCourseId();
        this.courseType = trBasicInfo.getCourseType();
        this.credit = trBasicInfo.getCredit();
        this.period = trBasicInfo.getPeriod();
        this.evaluationMode = trBasicInfo.getEvaluationMode();
        this.openTime = trBasicInfo.getOpenTime();
        this.teachingObject = trBasicInfo.getTeachingObject();
        this.selectionCount = trBasicInfo.getSelectionCount();
        this.participantCount = trBasicInfo.getParticipantCount();
        this.courseDegree = trBasicInfo.getCourseDegree();
        this.teacher = trBasicInfo.getTeacher();
        this.director = trBasicInfo.getDirector();
        this.participant = trBasicInfo.getParticipant();
        this.courseEvaluationSpread = trBasicInfo.getCourseEvaluationSpread();
        this.courseEvaluationResult = trBasicInfo.getCourseEvaluationResult();
        this.courseEvaluationResultDetail = trBasicInfo.getCourseEvaluationResultDetail();
    }

    public void setBasicInfo(Long examId, String courseCode, String courseName, String paperNumber, String openTime, String teachingObject, String teacher, Integer participantCount) {
        this.examId = examId;
        this.courseCode = courseCode;
        this.courseName = courseName;
        this.paperNumber = paperNumber;
        this.openTime = openTime;
        this.teachingObject = teachingObject;
        this.teacher = teacher;
        this.participantCount = participantCount;
        this.enable = true;
        this.reportResult = new ReportResult();
    }

    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 ReportResult getReportResult() {
        return reportResult;
    }

    public void setReportResult(ReportResult reportResult) {
        this.reportResult = reportResult;
    }

    public String getCredit() {
        return credit;
    }

    public void setCredit(String credit) {
        this.credit = credit;
    }

    public String getPeriod() {
        return period;
    }

    public void setPeriod(String period) {
        this.period = period;
    }

    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 getCourseType() {
        return courseType;
    }

    public void setCourseType(String courseType) {
        this.courseType = courseType;
    }

    public String getEvaluationMode() {
        return evaluationMode;
    }

    public void setEvaluationMode(String evaluationMode) {
        this.evaluationMode = evaluationMode;
    }

    public String getOpenTime() {
        return openTime;
    }

    public void setOpenTime(String openTime) {
        this.openTime = openTime;
    }

    public String getTeachingObject() {
        return teachingObject;
    }

    public void setTeachingObject(String teachingObject) {
        this.teachingObject = teachingObject;
    }

    public Double getCourseDegree() {
        return courseDegree;
    }

    public void setCourseDegree(Double courseDegree) {
        this.courseDegree = courseDegree;
    }

    public Integer getSelectionCount() {
        return selectionCount;
    }

    public void setSelectionCount(Integer selectionCount) {
        this.selectionCount = selectionCount;
    }

    public Integer getParticipantCount() {
        return participantCount;
    }

    public void setParticipantCount(Integer participantCount) {
        this.participantCount = participantCount;
    }

    public String getTeacher() {
        return teacher;
    }

    public void setTeacher(String teacher) {
        this.teacher = teacher;
    }

    public String getDirector() {
        return director;
    }

    public void setDirector(String director) {
        this.director = director;
    }

    public String getParticipant() {
        return participant;
    }

    public void setParticipant(String participant) {
        this.participant = participant;
    }

    public Boolean getEnable() {
        return enable;
    }

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

    public String getCourseEvaluationSpread() {
        return courseEvaluationSpread;
    }

    public void setCourseEvaluationSpread(String courseEvaluationSpread) {
        this.courseEvaluationSpread = courseEvaluationSpread;
    }

    public String getCourseEvaluationResult() {
        return courseEvaluationResult;
    }

    public void setCourseEvaluationResult(String courseEvaluationResult) {
        this.courseEvaluationResult = courseEvaluationResult;
    }

    public String getCourseEvaluationResultDetail() {
        return courseEvaluationResultDetail;
    }

    public void setCourseEvaluationResultDetail(String courseEvaluationResultDetail) {
        this.courseEvaluationResultDetail = courseEvaluationResultDetail;
    }
}
