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

import javax.persistence.*;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.Set;

/**
 * Created by 黄诚天 on 2017/7/4.
 */
@Table(name = PurchaseApBillOutSimpleInfo.TABLE_NAME)
@Entity
public class PurchaseApBillOutSimpleInfo {

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

    /**
     * 各字段列名（也是存储索引时的field名）
     */
    public static final String ID_FIELD = "pabo_id";
    public static final String TAXSUM_FIELD = "pabo_taxsum";
    public static final String DIFFER_FIELD = "pabo_differ";
    public static final String DATE_FIELD = "pabo_recorddate";
    public static final String RECORDER_FIELD = "pabo_recorder";
    public static final String CHECKSTATUS_FIELD = "pabo_checkstatus";
    public static final String REMARK_FIELD = "pabo_remark";
    public static final String AUDITDATE_FIELD = "pabo_auditdate";
    public static final String RESDATE_FIELD = "pabo_resdate";
    public static final String RESMAN_FIELD = "pabo_resman";
    public static final String STATUS_FIELD = "pabo_status";
    public static final String AMOUNT_FIELD = "pabo_amount";
    public static final String PAYAMOUNT_FIELD = "pabo_payamount";
    public static final String CURRENCY_FIELD = "pabo_currency";
    public static final String RATE_FIELD = "pabo_rate";
    public static final String CUSTUU_FIELD = "pabo_custuu";
    public static final String CUSTNAME_FIELD = "pabo_custname";
    public static final String ENUU_FIELD = "pabo_enuu";
    public static final String CODE_FIELD = "pabo_code";
    public static final String PRINT_FIELD = "pabo_print";
    public static final String ITEMS_FIELD = "pai_paboid";






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

    /**
     * 税金合计
     */
    @Column(name = TAXSUM_FIELD)
    private Double taxSum;

    /**
     * 税金差异
     */
    @Column(name = DIFFER_FIELD)
    private Double differ;

    /**
     * 录单日期
     */
    @Column(name = DATE_FIELD)
    private Date recordDate;

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


    /**
     * 开票状态
     */
    @Column(name = CHECKSTATUS_FIELD)
    private String checkStatus;

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

    /**
     * 提交日期
     */
    @Column(name = AUDITDATE_FIELD)
    private Date auditDate;

    /**
     * 作废日期
     */
    @Column(name = RESDATE_FIELD)
    private Date resDate;

    /**
     * 作废人
     */
    @Column(name = RESMAN_FIELD)
    private String resMan;

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

    /**
     * 开票金额
     */
    @Column(name = AMOUNT_FIELD)
    private Double amount;

    /**
     * 已付款金额
     */
    @Column(name = PAYAMOUNT_FIELD)
    private Double payAmount;

    /**
     * 币别
     */
    @Column(name = CURRENCY_FIELD)
    private String currency;

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


    /**
     * 客户UU
     */
    @Column(name = CUSTUU_FIELD)
    private Long custUu;

    /**
     * 客户名称
     */
    @Column(name = CUSTNAME_FIELD)
    private String custName;

    /**
     * 本企业UU
     */
    @Column(name = ENUU_FIELD)
    private Long enUu;

    /**
     * 单据编号
     */
    @Column(name = CODE_FIELD)
    private String code;

    /**
     * 打印次数
     */
    @Column(name = PRINT_FIELD)
    private Short print;

    /**
     * 开票单明细行
     */
    @OneToMany(cascade = { CascadeType.ALL }, fetch = FetchType.EAGER)
    @JoinColumn(name = ITEMS_FIELD, insertable = false, updatable = false)
    private Set<PurchaseApBillOutItemSimpleInfo> items;

    public Long getId() {
        return id;
    }

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

    public Double getTaxSum() {
        return taxSum;
    }

    public void setTaxSum(Double taxSum) {
        this.taxSum = taxSum;
    }

    public Double getDiffer() {
        return differ;
    }

    public void setDiffer(Double differ) {
        this.differ = differ;
    }

    public Date getRecordDate() {
        return recordDate;
    }

    public void setRecordDate(Date recordDate) {
        this.recordDate = recordDate;
    }

    public String getRecorder() {
        return recorder;
    }

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

    public String getCheckStatus() {
        return checkStatus;
    }

    public void setCheckStatus(String checkStatus) {
        this.checkStatus = checkStatus;
    }

    public String getRemark() {
        return remark;
    }

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

    public Date getAuditDate() {
        return auditDate;
    }

    public void setAuditDate(Date auditDate) {
        this.auditDate = auditDate;
    }

    public Date getResDate() {
        return resDate;
    }

    public void setResDate(Date resDate) {
        this.resDate = resDate;
    }

    public String getResMan() {
        return resMan;
    }

    public void setResMan(String resMan) {
        this.resMan = resMan;
    }

    public Short getStatus() {
        return status;
    }

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

    public Double getAmount() {
        return amount;
    }

    public void setAmount(Double amount) {
        this.amount = amount;
    }

    public Double getPayAmount() {
        return payAmount;
    }

    public void setPayAmount(Double payAmount) {
        this.payAmount = payAmount;
    }

    public String getCurrency() {
        return currency;
    }

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

    public Double getRate() {
        return rate;
    }

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

    public Long getCustUu() {
        return custUu;
    }

    public void setCustUu(Long custUu) {
        this.custUu = custUu;
    }

    public String getCustName() {
        return custName;
    }

    public void setCustName(String custName) {
        this.custName = custName;
    }

    public Long getEnUu() {
        return enUu;
    }

    public void setEnUu(Long enUu) {
        this.enUu = enUu;
    }

    public String getCode() {
        return code;
    }

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

    public Short getPrint() {
        return print;
    }

    public void setPrint(Short print) {
        this.print = print;
    }

    public Set<PurchaseApBillOutItemSimpleInfo> getItems() {
        return items;
    }

    public void setItems(Set<PurchaseApBillOutItemSimpleInfo> items) {
        this.items = items;
    }

    @Override
    public String toString() {
        return "PurchaseApBillOutSimpleInfo{" +
                "id=" + id +
                ", taxSum=" + taxSum +
                ", differ=" + differ +
                ", recordDate=" + recordDate +
                ", recorder='" + recorder + '\'' +
                ", checkStatus='" + checkStatus + '\'' +
                ", remark='" + remark + '\'' +
                ", auditDate=" + auditDate +
                ", resDate=" + resDate +
                ", resMan='" + resMan + '\'' +
                ", status=" + status +
                ", amount=" + amount +
                ", payAmount=" + payAmount +
                ", currency='" + currency + '\'' +
                ", rate=" + rate +
                ", custUu=" + custUu +
                ", custName='" + custName + '\'' +
                ", enUu=" + enUu +
                ", code='" + code + '\'' +
                ", print=" + print +
                ", items=" + items +
                '}';
    }

    /**
     * 获取除了status外的所有字段的列名（field名）
     *
     * @return
     */
    public static List<String> getKeywordFields() {
        List<String> fields = new ArrayList<>();
        fields.add(CODE_FIELD);
        fields.add(CUSTUU_FIELD);
        fields.add(ITEMS_FIELD);
        return fields;
    }
}
