package com.qmth.qrzk.repository.user.model;

import java.util.Date;
import java.util.HashSet;
import java.util.Set;

import javax.persistence.CascadeType;
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.JoinColumn;
import javax.persistence.JoinTable;
import javax.persistence.ManyToMany;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.persistence.Transient;

import com.qmth.qrzk.batch.model.PaperStateView;
import com.qmth.qrzk.paper.model.Paper;
import com.qmth.qrzk.repository.common.enumeration.BatchType;
import com.qmth.qrzk.repository.utils.Consts;

@Entity
@Table(name="qr_paper_batch")
public class PaperBatch{
	@Id
	@GeneratedValue
	private int id;
	
	private String code;
	
	private String title;
	
	/**
	 * 入库、复审、供卷、启用
	 */
	private String type;
	
	@Enumerated(EnumType.STRING)
	@Column(name="batch_type")
	private BatchType batchType;//批次类型
	
	@Transient
	private String batchTypeLabel;
	
	private String status;
	
	@Column(name="start_date")
	@Temporal(TemporalType.DATE)
	private Date startDate;
	
	@Column(name="end_date")
	@Temporal(TemporalType.DATE)
	private Date endDate;
	
	private String admin;
	
	@Column(name="created_by")
	private int createdBy;
	
	@Column(name="created_time")
	@Temporal(TemporalType.TIMESTAMP)
	private Date createdTime;
	
	@Column(name="updated_by")
	private int updatedBy;

	@Column(name="updated_time")
	@Temporal(TemporalType.TIMESTAMP)
	private Date updatedTime;
	
	private String remark;
	
	public static final String RUKU = Consts.BATCH_TYPE_RUKU;
	public static final String QINGYANG = Consts.BATCH_TYPE_QINGYANG;
	public static final String QIYONG = Consts.BATCH_TYPE_QIYONG;

	public int getId() {
		return id;
	}

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

	public String getCode() {
		return code;
	}

	public void setCode(String code) {
		this.code = code;
	}

	public String getTitle() {
		return title;
	}

	public void setTitle(String title) {
		this.title = title;
	}

	public String getType() {
		return type;
	}

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

	public String getStatus() {
		return status;
	}

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

	public Date getStartDate() {
		return startDate;
	}

	public void setStartDate(Date startDate) {
		this.startDate = startDate;
	}

	public Date getEndDate() {
		return endDate;
	}

	public void setEndDate(Date endDate) {
		this.endDate = endDate;
	}

	public String getAdmin() {
		return admin;
	}

	public void setAdmin(String admin) {
		this.admin = admin;
	}

	public int getCreatedBy() {
		return createdBy;
	}

	public void setCreatedBy(int createdBy) {
		this.createdBy = createdBy;
	}

	public Date getCreatedTime() {
		return createdTime;
	}

	public void setCreatedTime(Date createdTime) {
		this.createdTime = createdTime;
	}

	public int getUpdatedBy() {
		return updatedBy;
	}

	public void setUpdatedBy(int updatedBy) {
		this.updatedBy = updatedBy;
	}

	public Date getUpdatedTime() {
		return updatedTime;
	}

	public void setUpdatedTime(Date updatedTime) {
		this.updatedTime = updatedTime;
	}

	public String getRemark() {
		return remark;
	}

	public void setRemark(String remark) {
		this.remark = remark;
	}

	
	
	public BatchType getBatchType() {
		return batchType;
	}

	public void setBatchType(BatchType batchType) {
		this.batchType = batchType;
	}
	
	public String getBatchTypeLabel() {
		return this.batchType != null? this.batchType.getValue():null;
	}

	public void setBatchTypeLabel(String batchTypeLabel) {
		this.batchTypeLabel = batchTypeLabel;
	}

	public PaperBatch() {
		super();
		// TODO Auto-generated constructor stub
	}

	
	
	public PaperBatch(int id, String code, String type, String status,
			Date startDate, Date endDate, String admin, int createdBy,
			Date createdTime, int updatedBy, Date updatedTime, String remark) {
		super();
		this.id = id;
		this.code = code;
		this.type = type;
		this.status = status;
		this.startDate = startDate;
		this.endDate = endDate;
		this.admin = admin;
		this.createdBy = createdBy;
		this.createdTime = createdTime;
		this.updatedBy = updatedBy;
		this.updatedTime = updatedTime;
		this.remark = remark;
	}

	public PaperBatch(String code, Date startDate, Date endDate) {
		super();
		this.code = code;
		this.startDate = startDate;
		this.endDate = endDate;
	}

	public PaperBatch(String code, String type, Date startDate, Date endDate,
			String admin, int createdBy, Date createdTime, int updatedBy,
			Date updatedTime, String remark) {
		super();
		this.code = code;
		this.type = type;
		this.startDate = startDate;
		this.endDate = endDate;
		this.admin = admin;
		this.createdBy = createdBy;
		this.createdTime = createdTime;
		this.updatedBy = updatedBy;
		this.updatedTime = updatedTime;
		this.remark = remark;
	}
	
	public PaperBatch(String code, BatchType type, Date startDate, Date endDate,
			String admin, int createdBy, Date createdTime, int updatedBy,
			Date updatedTime, String remark) {
		super();
		this.code = code;
		this.batchType = type;
		this.type = type.getValue();
		this.startDate = startDate;
		this.endDate = endDate;
		this.admin = admin;
		this.createdBy = createdBy;
		this.createdTime = createdTime;
		this.updatedBy = updatedBy;
		this.updatedTime = updatedTime;
		this.remark = remark;
	}
	
	
}
