/*
 * 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.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.TCUSTPERSONPHONE")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "Tcustpersonphone.findAll", query = "SELECT t FROM Tcustpersonphone t"),
    @NamedQuery(name = "Tcustpersonphone.findByPersoncode", query = "SELECT t FROM Tcustpersonphone t WHERE t.tcustpersonphonePK.personcode = :personcode"),
    @NamedQuery(name = "Tcustpersonphone.findByPhonesequence", query = "SELECT t FROM Tcustpersonphone t WHERE t.tcustpersonphonePK.phonesequence = :phonesequence"),
    @NamedQuery(name = "Tcustpersonphone.findByDateto", query = "SELECT t FROM Tcustpersonphone t WHERE t.tcustpersonphonePK.dateto = :dateto"),
    @NamedQuery(name = "Tcustpersonphone.findByDatefrom", query = "SELECT t FROM Tcustpersonphone t WHERE t.datefrom = :datefrom"),
    @NamedQuery(name = "Tcustpersonphone.findByRecordversion", query = "SELECT t FROM Tcustpersonphone t WHERE t.recordversion = :recordversion"),
    @NamedQuery(name = "Tcustpersonphone.findByAddressnumber", query = "SELECT t FROM Tcustpersonphone t WHERE t.addressnumber = :addressnumber"),
    @NamedQuery(name = "Tcustpersonphone.findByAreacode", query = "SELECT t FROM Tcustpersonphone t WHERE t.areacode = :areacode"),
    @NamedQuery(name = "Tcustpersonphone.findByPhonenumber", query = "SELECT t FROM Tcustpersonphone t WHERE t.phonenumber = :phonenumber"),
    @NamedQuery(name = "Tcustpersonphone.findByExtension", query = "SELECT t FROM Tcustpersonphone t WHERE t.extension = :extension")})
public class Tcustpersonphone implements Serializable {

    private static final long serialVersionUID = 1L;
    @EmbeddedId
    protected TcustpersonphonePK tcustpersonphonePK;
    @Column(name = "DATEFROM")
    @Temporal(TemporalType.TIMESTAMP)
    private Date datefrom;
    @Column(name = "RECORDVERSION")
    private BigInteger recordversion;
    @Column(name = "ADDRESSNUMBER")
    private Short addressnumber;
    @Column(name = "AREACODE")
    private Short areacode;
    @Column(name = "PHONENUMBER")
    private String phonenumber;
    @Column(name = "EXTENSION")
    private Integer extension;
    @JoinColumn(name = "PERSONCODE", referencedColumnName = "PERSONCODE", insertable = false, updatable = false)
    @ManyToOne(optional = false)
    private Tcustperson tcustperson;
    @JoinColumns({
        @JoinColumn(name = "PHONETYPECATALOG", referencedColumnName = "CATALOG"),
        @JoinColumn(name = "PHONETYPECATALOGCODE", referencedColumnName = "CATALOGCODE")})
    @ManyToOne
    private Tgenecatalogdetail tgenecatalogdetail;
    @JoinColumn(name = "INGRESSUSERCODE", referencedColumnName = "USERCODE")
    @ManyToOne
    private Tsafeuser ingressusercode;
    @JoinColumn(name = "MODIFYUSERCODE", referencedColumnName = "USERCODE")
    @ManyToOne
    private Tsafeuser modifyusercode;

    public Tcustpersonphone() {
    }

    public Tcustpersonphone(TcustpersonphonePK tcustpersonphonePK) {
        this.tcustpersonphonePK = tcustpersonphonePK;
    }

    public Tcustpersonphone(long personcode, short phonesequence, Date dateto) {
        this.tcustpersonphonePK = new TcustpersonphonePK(personcode, phonesequence, dateto);
    }

    public TcustpersonphonePK getTcustpersonphonePK() {
        return tcustpersonphonePK;
    }

    public void setTcustpersonphonePK(TcustpersonphonePK tcustpersonphonePK) {
        this.tcustpersonphonePK = tcustpersonphonePK;
    }

    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 Short getAddressnumber() {
        return addressnumber;
    }

    public void setAddressnumber(Short addressnumber) {
        this.addressnumber = addressnumber;
    }

    public Short getAreacode() {
        return areacode;
    }

    public void setAreacode(Short areacode) {
        this.areacode = areacode;
    }

    public String getPhonenumber() {
        return phonenumber;
    }

    public void setPhonenumber(String phonenumber) {
        this.phonenumber = phonenumber;
    }

    public Integer getExtension() {
        return extension;
    }

    public void setExtension(Integer extension) {
        this.extension = extension;
    }

    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;
    }

    public Tsafeuser getIngressusercode() {
        return ingressusercode;
    }

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

    public Tsafeuser getModifyusercode() {
        return modifyusercode;
    }

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

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

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