/*
 * 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.TCUSTCOMPANYPRODUCTS")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "Tcustcompanyproducts.findAll", query = "SELECT t FROM Tcustcompanyproducts t"),
    @NamedQuery(name = "Tcustcompanyproducts.findByPersoncode", query = "SELECT t FROM Tcustcompanyproducts t WHERE t.tcustcompanyproductsPK.personcode = :personcode"),
    @NamedQuery(name = "Tcustcompanyproducts.findByDateto", query = "SELECT t FROM Tcustcompanyproducts t WHERE t.tcustcompanyproductsPK.dateto = :dateto"),
    @NamedQuery(name = "Tcustcompanyproducts.findByProductsequence", query = "SELECT t FROM Tcustcompanyproducts t WHERE t.tcustcompanyproductsPK.productsequence = :productsequence"),
    @NamedQuery(name = "Tcustcompanyproducts.findByDatefrom", query = "SELECT t FROM Tcustcompanyproducts t WHERE t.datefrom = :datefrom"),
    @NamedQuery(name = "Tcustcompanyproducts.findByRecordversion", query = "SELECT t FROM Tcustcompanyproducts t WHERE t.recordversion = :recordversion"),
    @NamedQuery(name = "Tcustcompanyproducts.findByAnnualsales", query = "SELECT t FROM Tcustcompanyproducts t WHERE t.annualsales = :annualsales"),
    @NamedQuery(name = "Tcustcompanyproducts.findByProductdetail", query = "SELECT t FROM Tcustcompanyproducts t WHERE t.productdetail = :productdetail"),
    @NamedQuery(name = "Tcustcompanyproducts.findByPercent", query = "SELECT t FROM Tcustcompanyproducts t WHERE t.percent = :percent"),
    @NamedQuery(name = "Tcustcompanyproducts.findByIsservice", query = "SELECT t FROM Tcustcompanyproducts t WHERE t.isservice = :isservice"),
    @NamedQuery(name = "Tcustcompanyproducts.findByIngressuser", query = "SELECT t FROM Tcustcompanyproducts t WHERE t.ingressuser = :ingressuser"),
    @NamedQuery(name = "Tcustcompanyproducts.findByModifyuser", query = "SELECT t FROM Tcustcompanyproducts t WHERE t.modifyuser = :modifyuser")})
public class Tcustcompanyproducts implements Serializable {

    private static final long serialVersionUID = 1L;
    @EmbeddedId
    protected TcustcompanyproductsPK tcustcompanyproductsPK;
    @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 = "ANNUALSALES")
    private BigDecimal annualsales;
    @Column(name = "PRODUCTDETAIL")
    private String productdetail;
    @Column(name = "PERCENT")
    private BigDecimal percent;
    @Column(name = "ISSERVICE")
    private String isservice;
    @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;
    @JoinColumns({
        @JoinColumn(name = "MARKETINGTYPECATALOG", referencedColumnName = "CATALOG"),
        @JoinColumn(name = "MARKETINGTYPECATALOGCODE", referencedColumnName = "CATALOGCODE")})
    @ManyToOne
    private Tgenecatalogdetail tgenecatalogdetail;

    public Tcustcompanyproducts() {
    }

    public Tcustcompanyproducts(TcustcompanyproductsPK tcustcompanyproductsPK) {
        this.tcustcompanyproductsPK = tcustcompanyproductsPK;
    }

    public Tcustcompanyproducts(TcustcompanyproductsPK tcustcompanyproductsPK, Date datefrom) {
        this.tcustcompanyproductsPK = tcustcompanyproductsPK;
        this.datefrom = datefrom;
    }

    public Tcustcompanyproducts(long personcode, Date dateto, short productsequence) {
        this.tcustcompanyproductsPK = new TcustcompanyproductsPK(personcode, dateto, productsequence);
    }

    public TcustcompanyproductsPK getTcustcompanyproductsPK() {
        return tcustcompanyproductsPK;
    }

    public void setTcustcompanyproductsPK(TcustcompanyproductsPK tcustcompanyproductsPK) {
        this.tcustcompanyproductsPK = tcustcompanyproductsPK;
    }

    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 getAnnualsales() {
        return annualsales;
    }

    public void setAnnualsales(BigDecimal annualsales) {
        this.annualsales = annualsales;
    }

    public String getProductdetail() {
        return productdetail;
    }

    public void setProductdetail(String productdetail) {
        this.productdetail = productdetail;
    }

    public BigDecimal getPercent() {
        return percent;
    }

    public void setPercent(BigDecimal percent) {
        this.percent = percent;
    }

    public String getIsservice() {
        return isservice;
    }

    public void setIsservice(String isservice) {
        this.isservice = isservice;
    }

    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 Tgenecatalogdetail getTgenecatalogdetail() {
        return tgenecatalogdetail;
    }

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

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (tcustcompanyproductsPK != null ? tcustcompanyproductsPK.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 Tcustcompanyproducts)) {
            return false;
        }
        Tcustcompanyproducts other = (Tcustcompanyproducts) object;
        if ((this.tcustcompanyproductsPK == null && other.tcustcompanyproductsPK != null) || (this.tcustcompanyproductsPK != null && !this.tcustcompanyproductsPK.equals(other.tcustcompanyproductsPK))) {
            return false;
        }
        return true;
    }

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