package cn.com.qmth.stmms.biz.exam.model;

import java.io.Serializable;
import java.util.Date;
import java.util.List;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.EnumType;
import javax.persistence.Enumerated;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

import cn.com.qmth.stmms.biz.mark.model.PictureConfigItem;
import cn.com.qmth.stmms.common.enums.ExamStatus;
import cn.com.qmth.stmms.common.enums.MarkMode;

@Entity
@Table(name = "eb_exam")
public class Exam implements Serializable {

    private static final long serialVersionUID = 5179623303410999209L;

    public static final String SUBJECT_ID_SPLIT = ",";

    @Id
    @GeneratedValue
    private Integer id;

    private String name;

    @Column(name = "school_id")
    private Integer schoolId;

    @Temporal(TemporalType.DATE)
    @Column(name = "exam_time")
    private Date examTime;

    @Enumerated(EnumType.ORDINAL)
    private ExamStatus status;

    @Column(name = "description", length = 128, nullable = true)
    private String description;

    /**
     * 开启强制特殊标记
     */
    @Column(name = "force_special_tag", nullable = false)
    private boolean forceSpecialTag;

    @Temporal(TemporalType.TIMESTAMP)
    @Column(name = "create_time")
    private Date createTime;

    @Temporal(TemporalType.TIMESTAMP)
    @Column(name = "update_time")
    private Date updateTime;

    @Column(name = "creator_id")
    private Integer creatorId;

    /**
     * 开启/关闭 原卷显示
     */
    @Column(name = "show_sheet", nullable = false)
    private boolean showSheet;

    /**
     * 强制评卷模式
     */
    @Column(name = "mark_mode", nullable = true)
    @Enumerated(EnumType.STRING)
    private MarkMode markMode;

    /**
     * 评卷起始时间
     */
    @Temporal(TemporalType.TIMESTAMP)
    @Column(name = "mark_start_time")
    private Date startTime;

    /**
     * 评卷结束时间
     */
    @Temporal(TemporalType.TIMESTAMP)
    @Column(name = "mark_end_time")
    private Date endTime;

    /**
     * 裁切图配置
     */
    @Column(name = "slice_config", nullable = true)
    private String sliceConfig;

    /**
     * 统分进度
     */
    @Column(name = "process")
    private Double process;

    /**
     * 是否需要统分
     */
    @Column(name = "need_calculate", nullable = false)
    private boolean needCalculate;

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public String getName() {
        return name;
    }

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

    public String getDescription() {
        return description;
    }

    public void setDescription(String description) {
        this.description = description;
    }

    public Date getExamTime() {
        return examTime;
    }

    public void setExamTime(Date examTime) {
        this.examTime = examTime;
    }

    public Date getCreateTime() {
        return createTime;
    }

    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
    }

    public Integer getCreatorId() {
        return creatorId;
    }

    public void setCreatorId(Integer creatorId) {
        this.creatorId = creatorId;
    }

    public Date getUpdateTime() {
        return updateTime;
    }

    public void setUpdateTime(Date updateTime) {
        this.updateTime = updateTime;
    }

    public ExamStatus getStatus() {
        return status;
    }

    public void setStatus(ExamStatus status) {
        this.status = status;
    }

    public Integer getSchoolId() {
        return schoolId;
    }

    public void setSchoolId(Integer schoolId) {
        this.schoolId = schoolId;
    }

    public boolean isForceSpecialTag() {
        return forceSpecialTag;
    }

    public void setForceSpecialTag(boolean forceSpecialTag) {
        this.forceSpecialTag = forceSpecialTag;
    }

    public boolean isShowSheet() {
        return showSheet;
    }

    public void setShowSheet(boolean showSheet) {
        this.showSheet = showSheet;
    }

    public MarkMode getMarkMode() {
        return markMode;
    }

    public void setMarkMode(MarkMode markMode) {
        this.markMode = markMode;
    }

    public Date getStartTime() {
        return startTime;
    }

    public void setStartTime(Date startTime) {
        this.startTime = startTime;
    }

    public Date getEndTime() {
        return endTime;
    }

    public void setEndTime(Date endTime) {
        this.endTime = endTime;
    }

    public String getSliceConfig() {
        return sliceConfig;
    }

    public void setSliceConfig(String sliceConfig) {
        this.sliceConfig = sliceConfig;
    }

    public List<PictureConfigItem> getSliceConfigList() {
        return PictureConfigItem.parse(sliceConfig);
    }

    public Double getProcess() {
        return process;
    }

    public void setProcess(Double process) {
        this.process = process;
    }

    public boolean isNeedCalculate() {
        return needCalculate;
    }

    public void setNeedCalculate(boolean needCalculate) {
        this.needCalculate = needCalculate;
    }

}
