package com.huigou.topsun.product.domain;

import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Objects;

import javax.persistence.*;

import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.huigou.topsun.common.NumberToStringSerializer;
import org.apache.commons.lang3.builder.ToStringBuilder;

/**
 * @author Tison
 * 产品
 */
@Entity
@Table(name = "product")
@JsonInclude(JsonInclude.Include.ALWAYS)
@JsonIgnoreProperties(ignoreUnknown = true)
public class Product implements Serializable {

	/**
	 * 产品ID
	 */
	@Id
	@Column(name = "product_id", nullable = false)
	@JsonSerialize(using = NumberToStringSerializer.class)
	private BigDecimal productId;

	/**
	 * 产品名称
	 */
	@Column(name = "product_name", nullable = true, length = 128)
	private String productName;

	/**
	 * 产品类别
	 */
	@Column(name = "product_category_id", nullable = true)
	private BigDecimal productCategoryId;

	/**
	 * 产品状态(码表status)
	 */
	@Column(name = "product_status", nullable = true, length = 32)
	private String productStatus;

	/**
	 * 产品计量单位
	 */
	@Column(name = "product_unit", nullable = true, length = 32)
	private String productUnit;

	/**
	 * 样品编号
	 */
	@Column(name = "product_sample_code", nullable = true, length = 32)
	private String productSampleCode;

	/**
	 * 品牌名称
	 */
	@Column(name = "brand_name", nullable = true, length = 128)
	private String brandName;

	/**
	 * 产品类型(prodcut_type)
	 */
	@Column(name = "product_type", nullable = true, length = 32)
	private String productType;

	/**
	 * 产品编码
	 */
	@Column(name = "product_code", nullable = true, length = 255)
	private String productCode;

	/**
	 * 尺码组id
	 */
	@Column(name = "product_size_group_id", nullable = true, length = 32)
	private String productSizeGroupId;

	/**
	 * 是否为唯一码产品
	 */
	@Column(name = "is_only_code", nullable = true, length = 1)
	private String isOnlyCode;

	/**
	 * 是否不考虑形体配色
	 */
	@Column(name = "is_body_color", nullable = true, length = 1)
	private String isBodyColor;

	/**
	 * 是否禁用
	 */
	@Column(name = "is_disable", nullable = true, length = 1)
	private String isDisable;

	/**
	 * 是否建立bom表
	 */
	@Column(name = "is_build_bom", nullable = true, length = 10)
	private String isBuildBom;

	/**
	 * 确认日期
	 */
	@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
	@Column(name = "confirm_date", nullable = true)
	private java.util.Date confirmDate;

	/**
	 * 确认人
	 */
	@Column(name = "comfirm_person", nullable = true, length = 32)
	private String comfirmPerson;

	/**
	 * 是否免检
	 */
	@Column(name = "is_free_inspection", nullable = true, length = 10)
	private String isFreeInspection;

	/**
	 * 不要质量loss%
	 */
	@Column(name = "is_no_quality_loss", nullable = true, length = 255)
	private String isNoQualityLoss;

	/**
	 * 样品单号
	 */
	@Column(name = "sample_order_no", nullable = true, length = 255)
	private String sampleOrderNo;

	/**
	 * 库存编码
	 */
	@Column(name = "stock_no", nullable = true, length = 255)
	private String stockNo;

	/**
	 * 库存名称
	 */
	@Column(name = "stock_name", nullable = true, length = 255)
	private String stockName;

	/**
	 * 存档编号
	 */
	@Column(name = "file_no", nullable = true, length = 255)
	private String fileNo;

	@Override
	public boolean equals(Object o) {
		if (this == o) { return true; }
		if (o == null || getClass() != o.getClass()) { return false; }
		Product product = (Product) o;
		return Objects.equals(productId, product.productId) && Objects.equals(productName, product.productName) && Objects.equals(productCategoryId, product.productCategoryId) && Objects.equals(productStatus, product.productStatus) && Objects.equals(productUnit, product.productUnit) && Objects.equals(productSampleCode, product.productSampleCode) && Objects.equals(brandName, product.brandName) && Objects.equals(productType, product.productType) && Objects.equals(productCode, product.productCode) && Objects.equals(productSizeGroupId, product.productSizeGroupId) && Objects.equals(isOnlyCode, product.isOnlyCode) && Objects.equals(isBodyColor, product.isBodyColor) && Objects.equals(isDisable, product.isDisable) && Objects.equals(isBuildBom, product.isBuildBom) && Objects.equals(confirmDate, product.confirmDate) && Objects.equals(comfirmPerson, product.comfirmPerson) && Objects.equals(isFreeInspection, product.isFreeInspection) && Objects.equals(isNoQualityLoss, product.isNoQualityLoss) && Objects.equals(sampleOrderNo, product.sampleOrderNo) && Objects.equals(stockNo, product.stockNo) && Objects.equals(stockName, product.stockName) && Objects.equals(fileNo, product.fileNo);
	}

	@Override
	public int hashCode() {
		return Objects.hash(productId, productName, productCategoryId, productStatus, productUnit, productSampleCode, brandName, productType, productCode, productSizeGroupId, isOnlyCode, isBodyColor, isDisable, isBuildBom, confirmDate, comfirmPerson, isFreeInspection, isNoQualityLoss, sampleOrderNo, stockNo, stockName, fileNo);
	}

	@Override
	public String toString() {
		return new ToStringBuilder(this)
				.toString();
	}

	public BigDecimal getProductId() { return productId; }

	public void setProductId(String productId) {
		this.productId = (productId != null) ? new BigDecimal(productId) : null;
	}

	public BigDecimal getProductCategoryId() {
		return productCategoryId;
	}

	public void setProductCategoryId(String productCategoryId) {
		this.productCategoryId = (productCategoryId != null) ? new BigDecimal(productCategoryId) : null;
	}

	public String getProductName() {
		return this.productName;
	}
	
	public void setProductName(String productName) {
		this.productName = productName;
	}
	
	public String getProductStatus() {
		return this.productStatus;
	}
	
	public void setProductStatus(String productStatus) {
		this.productStatus = productStatus;
	}
	
	public String getProductUnit() {
		return this.productUnit;
	}
	
	public void setProductUnit(String productUnit) {
		this.productUnit = productUnit;
	}
	
	public String getProductSampleCode() {
		return this.productSampleCode;
	}
	
	public void setProductSampleCode(String productSampleCode) {
		this.productSampleCode = productSampleCode;
	}
	
	public String getBrandName() {
		return this.brandName;
	}
	
	public void setBrandName(String brandName) {
		this.brandName = brandName;
	}
	
	public String getProductType() {
		return this.productType;
	}
	
	public void setProductType(String productType) {
		this.productType = productType;
	}
	
	public String getProductCode() {
		return this.productCode;
	}
	
	public void setProductCode(String productCode) {
		this.productCode = productCode;
	}
	
	public String getProductSizeGroupId() {
		return this.productSizeGroupId;
	}
	
	public void setProductSizeGroupId(String productSizeGroupId) {
		this.productSizeGroupId = productSizeGroupId;
	}
	
	public String getIsOnlyCode() {
		return this.isOnlyCode;
	}
	
	public void setIsOnlyCode(String isOnlyCode) {
		this.isOnlyCode = isOnlyCode;
	}
	
	public String getIsBodyColor() {
		return this.isBodyColor;
	}
	
	public void setIsBodyColor(String isBodyColor) {
		this.isBodyColor = isBodyColor;
	}
	
	public String getIsDisable() {
		return this.isDisable;
	}
	
	public void setIsDisable(String isDisable) {
		this.isDisable = isDisable;
	}
	
	public String getIsBuildBom() {
		return this.isBuildBom;
	}
	
	public void setIsBuildBom(String isBuildBom) {
		this.isBuildBom = isBuildBom;
	}
	
	public java.util.Date getConfirmDate() {
		return this.confirmDate;
	}
	
	public void setConfirmDate(java.util.Date confirmDate) {
		this.confirmDate = confirmDate;
	}
	
	public String getComfirmPerson() {
		return this.comfirmPerson;
	}
	
	public void setComfirmPerson(String comfirmPerson) {
		this.comfirmPerson = comfirmPerson;
	}
	
	public String getIsFreeInspection() {
		return this.isFreeInspection;
	}
	
	public void setIsFreeInspection(String isFreeInspection) {
		this.isFreeInspection = isFreeInspection;
	}
	
	public String getIsNoQualityLoss() {
		return this.isNoQualityLoss;
	}
	
	public void setIsNoQualityLoss(String isNoQualityLoss) {
		this.isNoQualityLoss = isNoQualityLoss;
	}
	
	public String getSampleOrderNo() {
		return this.sampleOrderNo;
	}
	
	public void setSampleOrderNo(String sampleOrderNo) {
		this.sampleOrderNo = sampleOrderNo;
	}
	
	public String getStockNo() {
		return this.stockNo;
	}
	
	public void setStockNo(String stockNo) {
		this.stockNo = stockNo;
	}
	
	public String getStockName() {
		return this.stockName;
	}
	
	public void setStockName(String stockName) {
		this.stockName = stockName;
	}
	
	public String getFileNo() {
		return this.fileNo;
	}
	
	public void setFileNo(String fileNo) {
		this.fileNo = fileNo;
	}
}
