/*
 * 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.Basic;
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.TCUSTCOMPANYCLIENT")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "Tcustcompanyclient.findAll", query = "SELECT t FROM Tcustcompanyclient t"),
    @NamedQuery(name = "Tcustcompanyclient.findByPersoncode", query = "SELECT t FROM Tcustcompanyclient t WHERE t.tcustcompanyclientPK.personcode = :personcode"),
    @NamedQuery(name = "Tcustcompanyclient.findByDateto", query = "SELECT t FROM Tcustcompanyclient t WHERE t.tcustcompanyclientPK.dateto = :dateto"),
    @NamedQuery(name = "Tcustcompanyclient.findByClientsequence", query = "SELECT t FROM Tcustcompanyclient t WHERE t.tcustcompanyclientPK.clientsequence = :clientsequence"),
    @NamedQuery(name = "Tcustcompanyclient.findByDatefrom", query = "SELECT t FROM Tcustcompanyclient t WHERE t.datefrom = :datefrom"),
    @NamedQuery(name = "Tcustcompanyclient.findByRecordversion", query = "SELECT t FROM Tcustcompanyclient t WHERE t.recordversion = :recordversion"),
    @NamedQuery(name = "Tcustcompanyclient.findByMaxcredit", query = "SELECT t FROM Tcustcompanyclient t WHERE t.maxcredit = :maxcredit"),
    @NamedQuery(name = "Tcustcompanyclient.findByAnnualpurchase", query = "SELECT t FROM Tcustcompanyclient t WHERE t.annualpurchase = :annualpurchase"),
    @NamedQuery(name = "Tcustcompanyclient.findByClientdate", query = "SELECT t FROM Tcustcompanyclient t WHERE t.clientdate = :clientdate"),
    @NamedQuery(name = "Tcustcompanyclient.findByName", query = "SELECT t FROM Tcustcompanyclient t WHERE t.name = :name"),
    @NamedQuery(name = "Tcustcompanyclient.findByRemark", query = "SELECT t FROM Tcustcompanyclient t WHERE t.remark = :remark"),
    @NamedQuery(name = "Tcustcompanyclient.findByIngressuser", query = "SELECT t FROM Tcustcompanyclient t WHERE t.ingressuser = :ingressuser"),
    @NamedQuery(name = "Tcustcompanyclient.findByModifyuser", query = "SELECT t FROM Tcustcompanyclient t WHERE t.modifyuser = :modifyuser")})
public class Tcustcompanyclient implements Serializable {

    private static final long serialVersionUID = 1L;
    @EmbeddedId
    protected TcustcompanyclientPK tcustcompanyclientPK;
    @Basic(optional = false)
    @Column(name = "DATEFROM")
    @Temporal(TemporalType.TIMESTAMP)
    private Date datefrom;
    @Column(name = "RECORDVERSION")
    private BigInteger recordversion;
    // @Max(value=?)  @Min(value=?)//if you know range of your decimal fields consider using these annotations to enforce field validation
    @Column(name = "MAXCREDIT")
    private BigDecimal maxcredit;
    @Column(name = "ANNUALPURCHASE")
    private BigDecimal annualpurchase;
    @Column(name = "CLIENTDATE")
    @Temporal(TemporalType.TIMESTAMP)
    private Date clientdate;
    @Column(name = "NAME")
    private String name;
    @Column(name = "REMARK")
    private String remark;
    @Column(name = "INGRESSUSER")
    private String ingressuser;
    @Column(name = "MODIFYUSER")
    private String modifyuser;
    @JoinColumn(name = "PERSONCODE", referencedColumnName = "PERSONCODE", insertable = false, updatable = false)
    @ManyToOne(optional = false)
    private Tcustperson tcustperson;
    @JoinColumn(name = "CLIENTPERSONCODE", referencedColumnName = "PERSONCODE")
    @ManyToOne
    private Tcustperson clientpersoncode;
    @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 Tcustcompanyclient() {
    }

    public Tcustcompanyclient(TcustcompanyclientPK tcustcompanyclientPK) {
        this.tcustcompanyclientPK = tcustcompanyclientPK;
    }

    public Tcustcompanyclient(TcustcompanyclientPK tcustcompanyclientPK, Date datefrom) {
        this.tcustcompanyclientPK = tcustcompanyclientPK;
        this.datefrom = datefrom;
    }

    public Tcustcompanyclient(long personcode, Date dateto, short clientsequence) {
        this.tcustcompanyclientPK = new TcustcompanyclientPK(personcode, dateto, clientsequence);
    }

    public TcustcompanyclientPK getTcustcompanyclientPK() {
        return tcustcompanyclientPK;
    }

    public void setTcustcompanyclientPK(TcustcompanyclientPK tcustcompanyclientPK) {
        this.tcustcompanyclientPK = tcustcompanyclientPK;
    }

    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 BigDecimal getMaxcredit() {
        return maxcredit;
    }

    public void setMaxcredit(BigDecimal maxcredit) {
        this.maxcredit = maxcredit;
    }

    public BigDecimal getAnnualpurchase() {
        return annualpurchase;
    }

    public void setAnnualpurchase(BigDecimal annualpurchase) {
        this.annualpurchase = annualpurchase;
    }

    public Date getClientdate() {
        return clientdate;
    }

    public void setClientdate(Date clientdate) {
        this.clientdate = clientdate;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getRemark() {
        return remark;
    }

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

    public String getIngressuser() {
        return ingressuser;
    }

    public void setIngressuser(String ingressuser) {
        this.ingressuser = ingressuser;
    }

    public String getModifyuser() {
        return modifyuser;
    }

    public void setModifyuser(String modifyuser) {
        this.modifyuser = modifyuser;
    }

    public Tcustperson getTcustperson() {
        return tcustperson;
    }

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

    public Tcustperson getClientpersoncode() {
        return clientpersoncode;
    }

    public void setClientpersoncode(Tcustperson clientpersoncode) {
        this.clientpersoncode = clientpersoncode;
    }

    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 += (tcustcompanyclientPK != null ? tcustcompanyclientPK.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 Tcustcompanyclient)) {
            return false;
        }
        Tcustcompanyclient other = (Tcustcompanyclient) object;
        if ((this.tcustcompanyclientPK == null && other.tcustcompanyclientPK != null) || (this.tcustcompanyclientPK != null && !this.tcustcompanyclientPK.equals(other.tcustcompanyclientPK))) {
            return false;
        }
        return true;
    }

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