/*
 * Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
 * Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template
 */
package com.qsoft.rs.sincoar.model;

import java.io.Serializable;
import java.math.BigDecimal;
import java.math.BigInteger;
import java.util.Date;
import javax.persistence.Column;
import javax.persistence.EmbeddedId;
import javax.persistence.Entity;
import javax.persistence.JoinColumn;
import javax.persistence.JoinColumns;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.xml.bind.annotation.XmlRootElement;

/**
 *
 * @author developer2
 */
@Entity
@Table(name="COMACO.TCUSTPEOPLETRADEREFERENCES")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "Tcustpeopletradereferences.findAll", query = "SELECT t FROM Tcustpeopletradereferences t"),
    @NamedQuery(name = "Tcustpeopletradereferences.findByPersoncode", query = "SELECT t FROM Tcustpeopletradereferences t WHERE t.tcustpeopletradereferencesPK.personcode = :personcode"),
    @NamedQuery(name = "Tcustpeopletradereferences.findByDateto", query = "SELECT t FROM Tcustpeopletradereferences t WHERE t.tcustpeopletradereferencesPK.dateto = :dateto"),
    @NamedQuery(name = "Tcustpeopletradereferences.findByTradesequence", query = "SELECT t FROM Tcustpeopletradereferences t WHERE t.tcustpeopletradereferencesPK.tradesequence = :tradesequence"),
    @NamedQuery(name = "Tcustpeopletradereferences.findByDatefrom", query = "SELECT t FROM Tcustpeopletradereferences t WHERE t.datefrom = :datefrom"),
    @NamedQuery(name = "Tcustpeopletradereferences.findByRecordversion", query = "SELECT t FROM Tcustpeopletradereferences t WHERE t.recordversion = :recordversion"),
    @NamedQuery(name = "Tcustpeopletradereferences.findByItem", query = "SELECT t FROM Tcustpeopletradereferences t WHERE t.item = :item"),
    @NamedQuery(name = "Tcustpeopletradereferences.findByPurchaseyear", query = "SELECT t FROM Tcustpeopletradereferences t WHERE t.purchaseyear = :purchaseyear"),
    @NamedQuery(name = "Tcustpeopletradereferences.findByAmount", query = "SELECT t FROM Tcustpeopletradereferences t WHERE t.amount = :amount"),
    @NamedQuery(name = "Tcustpeopletradereferences.findByInputamount", query = "SELECT t FROM Tcustpeopletradereferences t WHERE t.inputamount = :inputamount"),
    @NamedQuery(name = "Tcustpeopletradereferences.findByQuotasnumber", query = "SELECT t FROM Tcustpeopletradereferences t WHERE t.quotasnumber = :quotasnumber"),
    @NamedQuery(name = "Tcustpeopletradereferences.findByQuotavalue", query = "SELECT t FROM Tcustpeopletradereferences t WHERE t.quotavalue = :quotavalue"),
    @NamedQuery(name = "Tcustpeopletradereferences.findByTradename", query = "SELECT t FROM Tcustpeopletradereferences t WHERE t.tradename = :tradename"),
    @NamedQuery(name = "Tcustpeopletradereferences.findByTradephone", query = "SELECT t FROM Tcustpeopletradereferences t WHERE t.tradephone = :tradephone"),
    @NamedQuery(name = "Tcustpeopletradereferences.findByIngressusercode", query = "SELECT t FROM Tcustpeopletradereferences t WHERE t.ingressusercode = :ingressusercode"),
    @NamedQuery(name = "Tcustpeopletradereferences.findByModifyusercode", query = "SELECT t FROM Tcustpeopletradereferences t WHERE t.modifyusercode = :modifyusercode")})
public class Tcustpeopletradereferences implements Serializable {

    private static final long serialVersionUID = 1L;
    @EmbeddedId
    protected TcustpeopletradereferencesPK tcustpeopletradereferencesPK;
    @Column(name = "DATEFROM")
    @Temporal(TemporalType.TIMESTAMP)
    private Date datefrom;
    @Column(name = "RECORDVERSION")
    private BigInteger recordversion;
    @Column(name = "ITEM")
    private String item;
    @Column(name = "PURCHASEYEAR")
    private String purchaseyear;
    // @Max(value=?)  @Min(value=?)//if you know range of your decimal fields consider using these annotations to enforce field validation
    @Column(name = "AMOUNT")
    private BigDecimal amount;
    @Column(name = "INPUTAMOUNT")
    private BigDecimal inputamount;
    @Column(name = "QUOTASNUMBER")
    private Short quotasnumber;
    @Column(name = "QUOTAVALUE")
    private BigDecimal quotavalue;
    @Column(name = "TRADENAME")
    private String tradename;
    @Column(name = "TRADEPHONE")
    private String tradephone;
    @Column(name = "INGRESSUSERCODE")
    private String ingressusercode;
    @Column(name = "MODIFYUSERCODE")
    private String modifyusercode;
    @JoinColumn(name = "PERSONCODE", referencedColumnName = "PERSONCODE", insertable = false, updatable = false)
    @ManyToOne(optional = false)
    private Tcustperson tcustperson;
    @JoinColumn(name = "TRADEPERSONCODE", referencedColumnName = "PERSONCODE")
    @ManyToOne
    private Tcustperson tradepersoncode;
    @JoinColumns({
        @JoinColumn(name = "PAYMENTMETHODCATALOG", referencedColumnName = "CATALOG"),
        @JoinColumn(name = "PAYMENTMETHODCATALOGCODE", referencedColumnName = "CATALOGCODE")})
    @ManyToOne
    private Tgenecatalogdetail tgenecatalogdetail;
    @JoinColumn(name = "CURRENCYCODE", referencedColumnName = "CURRENCYCODE")
    @ManyToOne
    private Tgenecurrency currencycode;

    public Tcustpeopletradereferences() {
    }

    public Tcustpeopletradereferences(TcustpeopletradereferencesPK tcustpeopletradereferencesPK) {
        this.tcustpeopletradereferencesPK = tcustpeopletradereferencesPK;
    }

    public Tcustpeopletradereferences(long personcode, Date dateto, short tradesequence) {
        this.tcustpeopletradereferencesPK = new TcustpeopletradereferencesPK(personcode, dateto, tradesequence);
    }

    public TcustpeopletradereferencesPK getTcustpeopletradereferencesPK() {
        return tcustpeopletradereferencesPK;
    }

    public void setTcustpeopletradereferencesPK(TcustpeopletradereferencesPK tcustpeopletradereferencesPK) {
        this.tcustpeopletradereferencesPK = tcustpeopletradereferencesPK;
    }

    public Date getDatefrom() {
        return datefrom;
    }

    public void setDatefrom(Date datefrom) {
        this.datefrom = datefrom;
    }

    public BigInteger getRecordversion() {
        return recordversion;
    }

    public void setRecordversion(BigInteger recordversion) {
        this.recordversion = recordversion;
    }

    public String getItem() {
        return item;
    }

    public void setItem(String item) {
        this.item = item;
    }

    public String getPurchaseyear() {
        return purchaseyear;
    }

    public void setPurchaseyear(String purchaseyear) {
        this.purchaseyear = purchaseyear;
    }

    public BigDecimal getAmount() {
        return amount;
    }

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

    public BigDecimal getInputamount() {
        return inputamount;
    }

    public void setInputamount(BigDecimal inputamount) {
        this.inputamount = inputamount;
    }

    public Short getQuotasnumber() {
        return quotasnumber;
    }

    public void setQuotasnumber(Short quotasnumber) {
        this.quotasnumber = quotasnumber;
    }

    public BigDecimal getQuotavalue() {
        return quotavalue;
    }

    public void setQuotavalue(BigDecimal quotavalue) {
        this.quotavalue = quotavalue;
    }

    public String getTradename() {
        return tradename;
    }

    public void setTradename(String tradename) {
        this.tradename = tradename;
    }

    public String getTradephone() {
        return tradephone;
    }

    public void setTradephone(String tradephone) {
        this.tradephone = tradephone;
    }

    public String getIngressusercode() {
        return ingressusercode;
    }

    public void setIngressusercode(String ingressusercode) {
        this.ingressusercode = ingressusercode;
    }

    public String getModifyusercode() {
        return modifyusercode;
    }

    public void setModifyusercode(String modifyusercode) {
        this.modifyusercode = modifyusercode;
    }

    public Tcustperson getTcustperson() {
        return tcustperson;
    }

    public void setTcustperson(Tcustperson tcustperson) {
        this.tcustperson = tcustperson;
    }

    public Tcustperson getTradepersoncode() {
        return tradepersoncode;
    }

    public void setTradepersoncode(Tcustperson tradepersoncode) {
        this.tradepersoncode = tradepersoncode;
    }

    public Tgenecatalogdetail getTgenecatalogdetail() {
        return tgenecatalogdetail;
    }

    public void setTgenecatalogdetail(Tgenecatalogdetail tgenecatalogdetail) {
        this.tgenecatalogdetail = tgenecatalogdetail;
    }

    public Tgenecurrency getCurrencycode() {
        return currencycode;
    }

    public void setCurrencycode(Tgenecurrency currencycode) {
        this.currencycode = currencycode;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (tcustpeopletradereferencesPK != null ? tcustpeopletradereferencesPK.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Tcustpeopletradereferences)) {
            return false;
        }
        Tcustpeopletradereferences other = (Tcustpeopletradereferences) object;
        if ((this.tcustpeopletradereferencesPK == null && other.tcustpeopletradereferencesPK != null) || (this.tcustpeopletradereferencesPK != null && !this.tcustpeopletradereferencesPK.equals(other.tcustpeopletradereferencesPK))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "com.qsoft.rs.sincoar.model.Tcustpeopletradereferences[ tcustpeopletradereferencesPK=" + tcustpeopletradereferencesPK + " ]";
    }
    
}
