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

import java.util.ArrayList;
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 = PagingReleaseDetailSimpleInfo.TABLE_NAME)
@Entity
public class PagingReleaseDetailSimpleInfo {

	/**
	 * 表名
	 */
	public static final String TABLE_NAME = "PURC$PAGINGRELEASEDETAIL";

	/**
	 * 各字段名
	 */
	public static final String ID_FIELD = "prd_id";

	public static final String USERUU_FIELD = "prd_emuu";

	public static final String VEND_FIELD = "prd_venduu";

	public static final String USERNAME_FIELD = "prd_emname";

	public static final String READSTATUS_FIELD = "prd_readstatus";

	public static final String STATUS_FIELD = "prd_status";

	public static final String PUSHSTATUS_FIELD = "prd_pushstatus";

	public static final String TOTALSTATUS_FIELD = "prd_totalstatus";

	public static final String MAIN_FIELD = "prd_prid";

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

	/**
	 * 接收人UU
	 */
	@Column(name = USERUU_FIELD)
	private String userUU;

	/**
	 * 接收人姓名
	 */
	@Column(name = USERNAME_FIELD)
	private String userName;

	/**
	 * 阅读状态
	 */
	@Column(name = READSTATUS_FIELD)
	private Short readStatus;

	/**
	 * 推送状态
	 */
	@Column(name = PUSHSTATUS_FIELD)
	private Short pushStatus;

	/**
	 * 统计状态
	 */
	@Column(name = TOTALSTATUS_FIELD)
	private Short totalStatus;

	/**
	 * 获取状态
	 */
	@Column(name = STATUS_FIELD)
	private Short status;

	/**
	 * 接收人所在企业信息
	 */
	@OneToOne(cascade = { CascadeType.REFRESH })
	@JoinColumn(name = VEND_FIELD, insertable = false, updatable = false)
	private EnterpriseSimpleInfo enterprise;

	/**
	 * 消息主表
	 */
	@ManyToOne(cascade = CascadeType.ALL, optional = true)
	@JoinColumn(name = MAIN_FIELD, nullable = false)
	private PagingReleaseSimpleInfo pagingRelease;

	public Long getId() {
		return id;
	}

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

	public String getUserUU() {
		return userUU;
	}

	public void setUserUU(String userUU) {
		this.userUU = userUU;
	}

	public String getUserName() {
		return userName;
	}

	public void setUserName(String userName) {
		this.userName = userName;
	}

	public Short getReadStatus() {
		return readStatus;
	}

	public void setReadStatus(Short readStatus) {
		this.readStatus = readStatus;
	}

	public Short getPushStatus() {
		return pushStatus;
	}

	public void setPushStatus(Short pushStatus) {
		this.pushStatus = pushStatus;
	}

	public Short getTotalStatus() {
		return totalStatus;
	}

	public void setTotalStatus(Short totalStatus) {
		this.totalStatus = totalStatus;
	}

	public Short getStatus() {
		return status;
	}

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

	public EnterpriseSimpleInfo getEnterprise() {
		return enterprise;
	}

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

	public PagingReleaseSimpleInfo getPagingRelease() {
		return pagingRelease;
	}

	public void setPagingRelease(PagingReleaseSimpleInfo pagingRelease) {
		this.pagingRelease = pagingRelease;
	}

	@Override
	public String toString() {
		return "PagingReleaseDetailSimpleInfo [id=" + id + ", userUU=" + userUU + ", userName=" + userName
				+ ", readStatus=" + readStatus + ", pushStatus=" + pushStatus + ", totalStatus=" + totalStatus
				+ ", status=" + status + ", enterprise=" + enterprise + ", pagingRelease=" + pagingRelease + "]";
	}

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

}
