/*
 * 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.TCUSTCOMPANYPROVIDER")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "Tcustcompanyprovider.findAll", query = "SELECT t FROM Tcustcompanyprovider t"),
    @NamedQuery(name = "Tcustcompanyprovider.findByPersoncode", query = "SELECT t FROM Tcustcompanyprovider t WHERE t.tcustcompanyproviderPK.personcode = :personcode"),
    @NamedQuery(name = "Tcustcompanyprovider.findByDateto", query = "SELECT t FROM Tcustcompanyprovider t WHERE t.tcustcompanyproviderPK.dateto = :dateto"),
    @NamedQuery(name = "Tcustcompanyprovider.findByProvidersequence", query = "SELECT t FROM Tcustcompanyprovider t WHERE t.tcustcompanyproviderPK.providersequence = :providersequence"),
    @NamedQuery(name = "Tcustcompanyprovider.findByDatefrom", query = "SELECT t FROM Tcustcompanyprovider t WHERE t.datefrom = :datefrom"),
    @NamedQuery(name = "Tcustcompanyprovider.findByRecordversion", query = "SELECT t FROM Tcustcompanyprovider t WHERE t.recordversion = :recordversion"),
    @NamedQuery(name = "Tcustcompanyprovider.findByMaxcredit", query = "SELECT t FROM Tcustcompanyprovider t WHERE t.maxcredit = :maxcredit"),
    @NamedQuery(name = "Tcustcompanyprovider.findByAnnualpurchase", query = "SELECT t FROM Tcustcompanyprovider t WHERE t.annualpurchase = :annualpurchase"),
    @NamedQuery(name = "Tcustcompanyprovider.findByProviderdate", query = "SELECT t FROM Tcustcompanyprovider t WHERE t.providerdate = :providerdate"),
    @NamedQuery(name = "Tcustcompanyprovider.findByName", query = "SELECT t FROM Tcustcompanyprovider t WHERE t.name = :name"),
    @NamedQuery(name = "Tcustcompanyprovider.findByRemark", query = "SELECT t FROM Tcustcompanyprovider t WHERE t.remark = :remark"),
    @NamedQuery(name = "Tcustcompanyprovider.findByIngressuser", query = "SELECT t FROM Tcustcompanyprovider t WHERE t.ingressuser = :ingressuser"),
    @NamedQuery(name = "Tcustcompanyprovider.findByModifyuser", query = "SELECT t FROM Tcustcompanyprovider t WHERE t.modifyuser = :modifyuser")})
public class Tcustcompanyprovider implements Serializable {

    private static final long serialVersionUID = 1L;
    @EmbeddedId
    protected TcustcompanyproviderPK tcustcompanyproviderPK;
    @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 = "PROVIDERDATE")
    @Temporal(TemporalType.TIMESTAMP)
    private Date providerdate;
    @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 = "PROVIDERPERSONCODE", referencedColumnName = "PERSONCODE")
    @ManyToOne
    private Tcustperson providerpersoncode;
    @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 Tcustcompanyprovider() {
    }

    public Tcustcompanyprovider(TcustcompanyproviderPK tcustcompanyproviderPK) {
        this.tcustcompanyproviderPK = tcustcompanyproviderPK;
    }

    public Tcustcompanyprovider(TcustcompanyproviderPK tcustcompanyproviderPK, Date datefrom) {
        this.tcustcompanyproviderPK = tcustcompanyproviderPK;
        this.datefrom = datefrom;
    }

    public Tcustcompanyprovider(long personcode, Date dateto, short providersequence) {
        this.tcustcompanyproviderPK = new TcustcompanyproviderPK(personcode, dateto, providersequence);
    }

    public TcustcompanyproviderPK getTcustcompanyproviderPK() {
        return tcustcompanyproviderPK;
    }

    public void setTcustcompanyproviderPK(TcustcompanyproviderPK tcustcompanyproviderPK) {
        this.tcustcompanyproviderPK = tcustcompanyproviderPK;
    }

    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 getProviderdate() {
        return providerdate;
    }

    public void setProviderdate(Date providerdate) {
        this.providerdate = providerdate;
    }

    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 getProviderpersoncode() {
        return providerpersoncode;
    }

    public void setProviderpersoncode(Tcustperson providerpersoncode) {
        this.providerpersoncode = providerpersoncode;
    }

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

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