package com.uas.search.console.b2b.model;

import java.util.ArrayList;
import java.util.Date;
import java.util.List;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.OneToOne;
import javax.persistence.Table;

/**
 * 购物车
 *
 * @author wangmh
 * @time 创建时间：2017年6月22日
 */

@Table(name = CartSimpleInfo.TABLE_NAME)
@Entity
public class CartSimpleInfo {

    public static final String TABLE_NAME = "PURC$CART";

    public static final String ID_FIELD = "ca_id";

    public static final String AUDITOR_FIELD = "ca_auditor";

    public static final String CODE_FIELD = "ca_code";

    public static final String CURRENCY_FIELD = "ca_currency";

	public static final String DATE_FIELD = "ca_date";

	public static final String ENUU_FIELD = "ca_enuu";

	public static final String PAYMENTS_FIELD = "ca_payments";

	public static final String RATE_FIELD = "ca_rate";

	public static final String RECEIVECODE_FIELD = "ca_receivecode";

	public static final String RECEIVENAME_FIELD = "ca_receivename";

    public static final String RECORDER_FIELD = "ca_recorder";

    public static final String REMARK_FIELD = "ca_remark";

    public static final String SHIPADDRESS_FIELD = "ca_shipaddress";

    public static final String USERUU_FIELD = "ca_useruu";

	public static final String ENTERPRISE_FIELD = "ca_venduu";

    public static final String VENDUSERUU_FIELD = "ca_venduseruu";

    public static final String STATUS_FIELD = "ca_status";

    public static final String VENDUSER_FIELD = "ca_venduser";

    public static final String VENDUSERTEL_FIELD = "ca_vendusertel";

    /**
     * 主键
     */
    @Id
    @Column(name = ID_FIELD)
    private Long id;

    /**
     * 审核人
     */
    @Column(name = AUDITOR_FIELD)
    private String auditor;

    /**
     * 购物车单号
     */
    @Column(name = CODE_FIELD)
    private String code;

    /**
     * 付款币种
     */
    @Column(name = CURRENCY_FIELD)
    private String currency;

    /**
     * 单据归属日期
     */
    @Column(name = DATE_FIELD)
    private Date date;

    /**
     * 采购企业UU
     */
    @Column(name = ENUU_FIELD)
    private Long enUU;

    /**
     * 付款方式
     */
    @Column(name = PAYMENTS_FIELD)
    private String payments;

    /**
     * 汇率
     */
    @Column(name = RATE_FIELD)
    private Float rate;

    /**
     * 应付供应商编号
     */
    @Column(name = RECEIVECODE_FIELD)
    private String receiveCode;

    /**
     * 应付供应商名称
     */
    @Column(name = RECEIVENAME_FIELD)
    private String receiveName;

    /**
     * 录单人
     */
    @Column(name = RECORDER_FIELD)
    private String recorder;

    /**
     * 备注
     */
    @Column(name = REMARK_FIELD)
    private String remark;

    /**
     * 收货地址
     */
    @Column(name = SHIPADDRESS_FIELD)
    private String shipAddress;

    /**
     * 采购单所属采购员
     */
    @OneToOne(cascade = { CascadeType.REFRESH })
    @JoinColumn(name = USERUU_FIELD, insertable = false, updatable = false)
    private UserSimpleInfo user;

	/**
	 * 供应商企业UU
	 */
	@OneToOne
	@JoinColumn(name = ENTERPRISE_FIELD, insertable = false, updatable = false)
	private EnterpriseSimpleInfo enterprise;

    /**
     * 供应商联系人UU
     */
    @Column(name = VENDUSERUU_FIELD)
    private Long vendUserUU;

    /**
     * 提交状态
     */
    @Column(name = STATUS_FIELD)
    private Integer status;

    /**
     * 供应商联系人
     */
    @Column(name = VENDUSER_FIELD)
    private String venduser;

    /**
     * 供应商联系人电话
     */
    @Column(name = VENDUSERTEL_FIELD)
    private String vendusertel;

    public Long getId() {
        return id;
    }

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

    public String getAuditor() {
        return auditor;
    }

    public void setAuditor(String auditor) {
        this.auditor = auditor;
    }

    public String getCode() {
        return code;
    }

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

    public String getCurrency() {
        return currency;
    }

    public void setCurrency(String currency) {
        this.currency = currency;
    }

    public Date getDate() {
        return date;
    }

    public void setDate(Date date) {
        this.date = date;
    }

    public Long getEnUU() {
        return enUU;
    }

    public void setEnUU(Long enUU) {
        this.enUU = enUU;
    }

    public String getPayments() {
        return payments;
    }

    public void setPayments(String payments) {
        this.payments = payments;
    }

    public Float getRate() {
        return rate;
    }

    public void setRate(Float rate) {
        this.rate = rate;
    }

    public String getReceiveCode() {
        return receiveCode;
    }

    public void setReceiveCode(String receiveCode) {
        this.receiveCode = receiveCode;
    }

    public String getReceiveName() {
        return receiveName;
    }

    public void setReceiveName(String receiveName) {
        this.receiveName = receiveName;
    }

    public String getRecorder() {
        return recorder;
    }

    public void setRecorder(String recorder) {
        this.recorder = recorder;
    }

    public String getRemark() {
        return remark;
    }

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

    public String getShipAddress() {
        return shipAddress;
    }

    public void setShipAddress(String shipAddress) {
        this.shipAddress = shipAddress;
    }

    public UserSimpleInfo getUser() {
        return user;
    }

    public void setUser(UserSimpleInfo user) {
        this.user = user;
    }


	public EnterpriseSimpleInfo getEnterprise() {
		return enterprise;
	}

	public void setEnterprise(EnterpriseSimpleInfo enterprise) {
		this.enterprise = enterprise;
	}

	public Long getVendUserUU() {
        return vendUserUU;
    }

    public void setVendUserUU(Long vendUserUU) {
        this.vendUserUU = vendUserUU;
    }

    public Integer getStatus() {
        return status;
    }

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

    public String getVenduser() {
        return venduser;
    }

    public void setVenduser(String venduser) {
        this.venduser = venduser;
    }

    public String getVendusertel() {
        return vendusertel;
    }

    public void setVendusertel(String vendusertel) {
        this.vendusertel = vendusertel;
    }


    @Override
	public String toString() {
		return "CartSimpleInfo [id=" + id + ", auditor=" + auditor + ", code=" + code + ", currency=" + currency
				+ ", date=" + date + ", enUU=" + enUU + ", payments=" + payments + ", rate=" + rate + ", receiveCode="
				+ receiveCode + ", receiveName=" + receiveName + ", recorder=" + recorder + ", remark=" + remark
				+ ", shipAddress=" + shipAddress + ", user=" + user + ", enterprise=" + enterprise + ", vendUserUU="
				+ vendUserUU + ", status=" + status + ", venduser=" + venduser + ", vendusertel=" + vendusertel + "]";
	}

	/**
	 * 获取所有可以搜索的字段列名（索引的field名）
	 *
	 * @return 可以搜索的字段列名
	 */
    public static List<String> getKeywordFields() {
        List<String> fields = new ArrayList<>();
        fields.add(CODE_FIELD);
        fields.add(ENUU_FIELD);
        fields.add(VENDUSERUU_FIELD);
        fields.add(VENDUSER_FIELD);
		fields.add(ENTERPRISE_FIELD);
        return fields;
    }
}
