package com.uas.platform.b2b.model;

import com.uas.platform.core.model.Constant;

import javax.persistence.*;
import javax.validation.constraints.NotNull;
import java.io.Serializable;
import java.util.Date;

/**
 * 消息明细表
 * Created by dongbw on 17/03/22 14:55.
 */
@Entity
@Table(name = "purc$pagingreleasedetail")
public class PagingReleaseDetail implements Serializable{

    /**
     * 序号
     */
    private static final long serialVersionUID = 1L;

    @Id
    @GeneratedValue(strategy = GenerationType.AUTO)
    @Column(name = "prd_id")
    private Long id;

    /**
     * 接收人UU
     */
    @Column(name = "prd_emuu")
    @NotNull
    private Long vendUserUU;

//    /**
//     * 采购单所属采购员
//     */
//    @OneToOne(cascade = { CascadeType.REFRESH })
//    @JoinColumn(name = "prd_emuu", insertable = false, updatable = false)
//    private UserBaseInfo vendUser;

    /**
     * 供应商企业UU
     */
    @Column(name = "prd_venduu")
    @NotNull
    private Long vendUU;

    /**
     * 供应商企业
     */
    @OneToOne(cascade = CascadeType.REFRESH)
    @JoinColumn(name = "prd_venduu", insertable = false, updatable = false)
    private EnterpriseInfo vendor;

    /**
     * 接收人姓名
     */
    @Column(name = "prd_emname")
    private String vendUserName;

    /**
     * 阅读时间
     */
    @Column(name = "prd_readdate")
    private Date readDate;

    /**
     * 阅读状态 0未读，1已读
     */
    @Column(name = "prd_readstatus")
    private Short readStatus;

    /**
     * 获取状态 0未获取，1已获取
     */
    @Column(name = "prd_status")
    private Short status;

    /**
     * 推送状态 0未推送，1已推送
     */
    @Column(name = "prd_pushstatus")
    private Short pushStatus;

    /**
     * 统计状态 0未统计，1已统计（app列表进入）
     */
    @Column(name = "prd_totalstatus")
    private Short totalStatus;

    /**
     * 消息主表
     */
    @ManyToOne(cascade = CascadeType.ALL)
    @JoinColumn(name = "prd_prid", nullable = false)
    private PagingRelease pagingRelease;

    public PagingReleaseDetail() {
    }

    public PagingReleaseDetail(Long vendUU, Long vendUserUU, String vendUserName) {
        this.vendUU = vendUU;
        this.vendUserUU = vendUserUU;
        this.vendUserName = vendUserName;
        this.readStatus = Constant.NO;
        this.status = Constant.NO;
        this.pushStatus = Constant.NO;
        this.totalStatus = Constant.NO;
    }

    public Long getId() {
        return id;
    }

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

    public Long getVendUserUU() {
        return vendUserUU;
    }

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

//    public User getVendUser() {
//        return vendUser;
//    }
//
//    public void setVendUser(User vendUser) {
//        this.vendUser = vendUser;
//    }

    public Long getVendUU() {
        return vendUU;
    }

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

    public Date getReadDate() {
        return readDate;
    }

    public void setReadDate(Date readDate) {
        this.readDate = readDate;
    }

    public String getVendUserName() {
        return vendUserName;
    }

    public void setVendUserName(String vendUserName) {
        this.vendUserName = vendUserName;
    }

//    public EnterpriseInfo getVendor() {
//        return vendor;
//    }
//
//    public void setVendor(EnterpriseInfo vendor) {
//        this.vendor = vendor;
//    }


    public Short getReadStatus() {
        return readStatus;
    }

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

    public Short getStatus() {
        return status;
    }

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

    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 PagingRelease getPagingRelease() {
        return pagingRelease;
    }

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

    public EnterpriseInfo getVendor() {
        return vendor;
    }

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