package cn.com.qmth.stmms.biz.subjectheader.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.Transient;

import cn.com.qmth.stmms.biz.distributpaper.model.FormallyHistory;
import cn.com.qmth.stmms.biz.distributpaper.model.TryHistory;
import cn.com.qmth.stmms.biz.exam.model.Marker;
import cn.com.qmth.stmms.biz.exam.model.SubjectiveBlock;
import cn.com.qmth.stmms.common.enums.LibraryStatus;
import cn.com.qmth.stmms.common.enums.LibraryType;

@Entity
@Table(name = "m_random_library")
public class RandomLibrary implements Serializable {

    private static final long serialVersionUID = -3674108817388842931L;

    @Id
    @GeneratedValue
    private Integer id;

    /**
     * 学校ID
     */
    @Column(name = "library_id")
    private Integer libraryId;

    /**
     * 密号
     */
    @Column(name = "secret_no")
    private Integer secretNo;

    /**
     * 块ID
     */
    @Column(name = "block_id")
    private Integer blockId;

    /**
     * 评卷员ID
     */
    @Column(name = "marker_id")
    private Integer markerId;

    /**
     * 状态，0：未处理1：已给分2:已打回
     */
    @Enumerated(EnumType.ORDINAL)
    @Column(name = "status")
    private LibraryStatus status;

    /**
     * 类型：1：试评2：正评
     */
    @Enumerated(EnumType.ORDINAL)
    @Column(name = "type")
    private LibraryType type;

    /**
     * 发生时间
     */
    @Column(name = "check_time")
    private Date checkTime;

    /**
     * 发生时间
     */
    @Column(name = "mark_time")
    private Date markTime;

    @Transient
    private Marker marker;

    @Transient
    private SubjectiveBlock subjectiveBlock;

    @Transient
    private List<TryHistory> tryHistoryList;

    @Transient
    private List<FormallyHistory> formallyHistoryList;

    @Transient
    private String pictureConfig;

    @Transient
    private List<String> pictureUrls;

    public Integer getId() {
        return id;
    }

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

    public SubjectiveBlock getSubjectiveBlock() {
        return subjectiveBlock;
    }

    public void setSubjectiveBlock(SubjectiveBlock subjectiveBlock) {
        this.subjectiveBlock = subjectiveBlock;
    }

    public LibraryStatus getStatus() {
        return status;
    }

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

    public LibraryType getType() {
        return type;
    }

    public void setType(LibraryType type) {
        this.type = type;
    }

    public Integer getLibraryId() {
        return libraryId;
    }

    public void setLibraryId(Integer libraryId) {
        this.libraryId = libraryId;
    }

    public Date getCheckTime() {
        return checkTime;
    }

    public void setCheckTime(Date checkTime) {
        this.checkTime = checkTime;
    }

    public List<TryHistory> getTryHistoryList() {
        return tryHistoryList;
    }

    public void setTryHistoryList(List<TryHistory> tryHistoryList) {
        this.tryHistoryList = tryHistoryList;
    }

    public List<FormallyHistory> getFormallyHistoryList() {
        return formallyHistoryList;
    }

    public void setFormallyHistoryList(List<FormallyHistory> formallyHistoryList) {
        this.formallyHistoryList = formallyHistoryList;
    }

    public Integer getSecretNo() {
        return secretNo;
    }

    public void setSecretNo(Integer secretNo) {
        this.secretNo = secretNo;
    }

    public Integer getBlockId() {
        return blockId;
    }

    public void setBlockId(Integer blockId) {
        this.blockId = blockId;
    }

    public Integer getMarkerId() {
        return markerId;
    }

    public void setMarkerId(Integer markerId) {
        this.markerId = markerId;
    }

    public Date getMarkTime() {
        return markTime;
    }

    public void setMarkTime(Date markTime) {
        this.markTime = markTime;
    }

    public Marker getMarker() {
        return marker;
    }

    public void setMarker(Marker marker) {
        this.marker = marker;
    }

    public String getPictureConfig() {
        return pictureConfig;
    }

    public void setPictureConfig(String pictureConfig) {
        this.pictureConfig = pictureConfig;
    }

    public String getPictureUrls() {
        StringBuilder sb = new StringBuilder();
        sb.append("[");
        if (pictureUrls != null && pictureUrls.size() > 0) {
            int length = pictureUrls.size();
            for (int i = 0; i < length; i++) {
                sb.append("\"").append(pictureUrls.get(i)).append("\"");
                if (i < (length - 1)) {
                    sb.append(",");
                }
            }
        }
        sb.append("]");
        return sb.toString();
    }

    public void setPictureUrls(List<String> pictureUrls) {
        this.pictureUrls = pictureUrls;
    }

}
