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.ManyToOne;
import javax.persistence.OneToOne;
import javax.persistence.Table;

/**
 * 投标方提问单 
 * 
 */
@Table(name = SaleTenderQuestionSimpleInfo.TABLE_NAME)
@Entity
public class SaleTenderQuestionSimpleInfo {

	/**
	 * 表名
	 */
	public static final String TABLE_NAME = "SALE$TENDERQUESTION";

	/**
	 * 各字段列名（也是存储索引时的field名）
	 */
	public static final String ID_FIELD = "stq_id";

	public static final String CODE_FIELD = "stq_code";

	public static final String VEND_FIELD = "stq_venduu";

	public static final String DATE_FIELD = "stq_indate";

	public static final String REPLYDATE_FIELD = "stq_replydate";

	public static final String TOPIC_FIELD = "stq_topic";

	public static final String STATUS_FIELD = "stq_status";

	public static final String CONTENT_FIELD = "stq_content";

	public static final String ANSWER_FIELD = "stq_ptaid";

    @Id
	@Column(name = ID_FIELD)
    private Long id;

    /**
     * 提问编号
     */
	@Column(name = CODE_FIELD)
    private String code;

    /**
     * 投标企业UU
     */
	@Column(name = VEND_FIELD)
    private Long vendUU;

    /**
     * 投标企业
     */
    @OneToOne
	@JoinColumn(name = VEND_FIELD, insertable = false, updatable = false)
	private EnterpriseSimpleInfo vendor;

    /**
     * 提出时间
     */
	@Column(name = DATE_FIELD)
    private Date inDate;

    /**
     * 回复时间
     */
	@Column(name = REPLYDATE_FIELD)
    private Date replyDate;

    /**
     * 提问主题
     */
	@Column(name = TOPIC_FIELD)
    private String topic;

    /**
     * 处理状态
     */
	@Column(name = STATUS_FIELD)
    private Short status;

    /**
     * 咨询内容
     */
	@Column(name = CONTENT_FIELD)
    private String content;

    /**
     * 招标答疑单
     */
    @ManyToOne(cascade = CascadeType.REFRESH)
	@JoinColumn(name = ANSWER_FIELD, nullable = false)
	private PurchaseTenderAnswer anwser;

	public Long getId() {
		return id;
	}

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

	public String getCode() {
		return code;
	}

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

	public Long getVendUU() {
		return vendUU;
	}

	public void setVendUU(Long vendUU) {
		this.vendUU = vendUU;
	}

	public EnterpriseSimpleInfo getVendor() {
		return vendor;
	}

	public void setVendor(EnterpriseSimpleInfo vendor) {
		this.vendor = vendor;
	}

	public Date getInDate() {
		return inDate;
	}

	public void setInDate(Date inDate) {
		this.inDate = inDate;
	}

	public Date getReplyDate() {
		return replyDate;
	}

	public void setReplyDate(Date replyDate) {
		this.replyDate = replyDate;
	}

	public String getTopic() {
		return topic;
	}


	public void setTopic(String topic) {
		this.topic = topic;
	}



	public Short getStatus() {
		return status;
	}



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



	public String getContent() {
		return content;
	}



	public void setContent(String content) {
		this.content = content;
	}



	public PurchaseTenderAnswer getAnwser() {
		return anwser;
	}



	public void setAnwser(PurchaseTenderAnswer anwser) {
		this.anwser = anwser;
	}

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

	@Override
	public String toString() {
		return "SaleTenderQuestionSimpleInfo [id=" + id + ", code=" + code + ", vendUU=" + vendUU + ", vendor=" + vendor
				+ ", inDate=" + inDate + ", replyDate=" + replyDate + ", topic=" + topic + ", status=" + status
				+ ", content=" + content + "]";
	}


}
