package com.qmth.qrzk.supplypaper.model;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.EnumType;
import javax.persistence.Enumerated;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
import javax.persistence.Transient;

import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.qmth.qrzk.repository.common.enumeration.PaperFormat;
import com.qmth.qrzk.repository.common.enumeration.PaperType;

/**
 * 供卷省份信息
 * @author zhengmin
 *
 */
@JsonIgnoreProperties(value="supplyCourse")
@Entity
@Table(name="qr_supply_prov_info")
public class SupplyProvInfo {

	@Id
	@GeneratedValue
	private Long id;
	@Column(name="supply_course_id")
	private long supplyCourseId;//供卷课程id
	
	@ManyToOne(fetch=FetchType.LAZY)
	@JoinColumn(name="supply_course_id",updatable=false,insertable=false)
	private SupplyCourse supplyCourse;
	
	@Column(name="batch_id")
	private int batchId;
	@Column(name="course_code")
	private String courseCode;
	@Column(name="course_name")
	private String courseName;
	@Column(name="prov_code")
	private Integer provCode;//省份代码
	@Column(name="prov_name")
	private String provName;//省份名称
	@Enumerated(EnumType.STRING)
	@Column(name="paper_type")
	private PaperType paperType;//试卷类型
	@Transient
	private String paperTypeLabel;//试卷类型中文标签
	@Enumerated(EnumType.STRING)
	@Column(name="paper_format")
	private PaperFormat paperFormat;//试卷格式
	@Transient
	private String paperFormatLabel;//试卷格式中文标签
	
	public long getId() {
		return id;
	}
	public void setId(Long id) {
		this.id = id;
	}
	public Long getSupplyCourseId() {
		return supplyCourseId;
	}
	public void setSupplyCourseId(long supplyCourseId) {
		this.supplyCourseId = supplyCourseId;
	}
	public Integer getProvCode() {
		return provCode;
	}
	public void setProvCode(Integer provCode) {
		this.provCode = provCode;
	}
	public String getProvName() {
		return provName;
	}
	public void setProvName(String provName) {
		this.provName = provName;
	}
	public PaperType getPaperType() {
		return paperType;
	}
	public void setPaperType(PaperType paperType) {
		this.paperType = paperType;
	}
	public PaperFormat getPaperFormat() {
		return paperFormat;
	}
	public void setPaperFormat(PaperFormat paperFormat) {
		this.paperFormat = paperFormat;
	}
	public String getPaperTypeLabel() {
		return paperType == null?null:paperType.getValue();
	}
	public void setPaperTypeLabel(String paperTypeLabel) {
		this.paperTypeLabel = paperTypeLabel;
	}
	public String getPaperFormatLabel() {
		return paperFormat == null?null:paperFormat.getValue();
	}
	public void setPaperFormatLabel(String paperFormatLabel) {
		this.paperFormatLabel = paperFormatLabel;
	}
	public int getBatchId() {
		return batchId;
	}
	public void setBatchId(int batchId) {
		this.batchId = batchId;
	}
	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 SupplyCourse getSupplyCourse() {
		return supplyCourse;
	}
	public void setSupplyCourse(SupplyCourse supplyCourse) {
		this.supplyCourse = supplyCourse;
	}
	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result
				+ (int) (supplyCourseId ^ (supplyCourseId >>> 32));
		return result;
	}
	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		SupplyProvInfo other = (SupplyProvInfo) obj;
		if (supplyCourseId != other.supplyCourseId)
			return false;
		return true;
	}
	
	
}
