/*
 * 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.TCUSTPERSONADDRESS")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "Tcustpersonaddress.findAll", query = "SELECT t FROM Tcustpersonaddress t"),
    @NamedQuery(name = "Tcustpersonaddress.findByPersoncode", query = "SELECT t FROM Tcustpersonaddress t WHERE t.tcustpersonaddressPK.personcode = :personcode"),
    @NamedQuery(name = "Tcustpersonaddress.findByAddressnumber", query = "SELECT t FROM Tcustpersonaddress t WHERE t.tcustpersonaddressPK.addressnumber = :addressnumber"),
    @NamedQuery(name = "Tcustpersonaddress.findByDateto", query = "SELECT t FROM Tcustpersonaddress t WHERE t.tcustpersonaddressPK.dateto = :dateto"),
    @NamedQuery(name = "Tcustpersonaddress.findByDatefrom", query = "SELECT t FROM Tcustpersonaddress t WHERE t.datefrom = :datefrom"),
    @NamedQuery(name = "Tcustpersonaddress.findByRecordversion", query = "SELECT t FROM Tcustpersonaddress t WHERE t.recordversion = :recordversion"),
    @NamedQuery(name = "Tcustpersonaddress.findByPrincipal", query = "SELECT t FROM Tcustpersonaddress t WHERE t.principal = :principal"),
    @NamedQuery(name = "Tcustpersonaddress.findByStreet", query = "SELECT t FROM Tcustpersonaddress t WHERE t.street = :street"),
    @NamedQuery(name = "Tcustpersonaddress.findByStreetnumber", query = "SELECT t FROM Tcustpersonaddress t WHERE t.streetnumber = :streetnumber"),
    @NamedQuery(name = "Tcustpersonaddress.findByDepartment", query = "SELECT t FROM Tcustpersonaddress t WHERE t.department = :department"),
    @NamedQuery(name = "Tcustpersonaddress.findByUrbanization", query = "SELECT t FROM Tcustpersonaddress t WHERE t.urbanization = :urbanization"),
    @NamedQuery(name = "Tcustpersonaddress.findByAddress", query = "SELECT t FROM Tcustpersonaddress t WHERE t.address = :address"),
    @NamedQuery(name = "Tcustpersonaddress.findByRemark", query = "SELECT t FROM Tcustpersonaddress t WHERE t.remark = :remark")})
public class Tcustpersonaddress implements Serializable {

    private static final long serialVersionUID = 1L;
    @EmbeddedId
    protected TcustpersonaddressPK tcustpersonaddressPK;
    @Column(name = "DATEFROM")
    @Temporal(TemporalType.TIMESTAMP)
    private Date datefrom;
    @Column(name = "RECORDVERSION")
    private BigInteger recordversion;
    @Column(name = "PRINCIPAL")
    private String principal;
    @Column(name = "STREET")
    private String street;
    @Column(name = "STREETNUMBER")
    private String streetnumber;
    @Column(name = "DEPARTMENT")
    private String department;
    @Column(name = "URBANIZATION")
    private String urbanization;
    @Column(name = "ADDRESS")
    private String address;
    @Column(name = "REMARK")
    private String remark;
    @JoinColumn(name = "PERSONCODE", referencedColumnName = "PERSONCODE", insertable = false, updatable = false)
    @ManyToOne(optional = false)
    private Tcustperson tcustperson;
    @JoinColumns({
        @JoinColumn(name = "ADDRESSTYPECATALOG", referencedColumnName = "CATALOG"),
        @JoinColumn(name = "ADDRESSTYPECATALOGCODE", referencedColumnName = "CATALOGCODE")})
    @ManyToOne
    private Tgenecatalogdetail tgenecatalogdetail;
    @JoinColumns({
        @JoinColumn(name = "COUNTRYCODE", referencedColumnName = "COUNTRYCODE"),
        @JoinColumn(name = "PROVINCECODE", referencedColumnName = "PROVINCECODE"),
        @JoinColumn(name = "CANTONCODE", referencedColumnName = "CANTONCODE"),
        @JoinColumn(name = "CITYCODE", referencedColumnName = "CITYCODE")})
    @ManyToOne
    private Tgenecity tgenecity;
    @JoinColumns({
        @JoinColumn(name = "COUNTRYCODE", referencedColumnName = "COUNTRYCODE"),
        @JoinColumn(name = "PROVINCECODE", referencedColumnName = "PROVINCECODE"),
        @JoinColumn(name = "CANTONCODE", referencedColumnName = "CANTONCODE"),
        @JoinColumn(name = "PARROQUIACODE", referencedColumnName = "PARROQUIACODE")})
    @ManyToOne
    private Tgeneparroquia tgeneparroquia;
    @JoinColumn(name = "INGRESSUSERCODE", referencedColumnName = "USERCODE")
    @ManyToOne
    private Tsafeuser ingressusercode;
    @JoinColumn(name = "MODIFYUSERCODE", referencedColumnName = "USERCODE")
    @ManyToOne
    private Tsafeuser modifyusercode;

    public Tcustpersonaddress() {
    }

    public Tcustpersonaddress(TcustpersonaddressPK tcustpersonaddressPK) {
        this.tcustpersonaddressPK = tcustpersonaddressPK;
    }

    public Tcustpersonaddress(long personcode, short addressnumber, Date dateto) {
        this.tcustpersonaddressPK = new TcustpersonaddressPK(personcode, addressnumber, dateto);
    }

    public TcustpersonaddressPK getTcustpersonaddressPK() {
        return tcustpersonaddressPK;
    }

    public void setTcustpersonaddressPK(TcustpersonaddressPK tcustpersonaddressPK) {
        this.tcustpersonaddressPK = tcustpersonaddressPK;
    }

    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 getPrincipal() {
        return principal;
    }

    public void setPrincipal(String principal) {
        this.principal = principal;
    }

    public String getStreet() {
        return street;
    }

    public void setStreet(String street) {
        this.street = street;
    }

    public String getStreetnumber() {
        return streetnumber;
    }

    public void setStreetnumber(String streetnumber) {
        this.streetnumber = streetnumber;
    }

    public String getDepartment() {
        return department;
    }

    public void setDepartment(String department) {
        this.department = department;
    }

    public String getUrbanization() {
        return urbanization;
    }

    public void setUrbanization(String urbanization) {
        this.urbanization = urbanization;
    }

    public String getAddress() {
        return address;
    }

    public void setAddress(String address) {
        this.address = address;
    }

    public String getRemark() {
        return remark;
    }

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

    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 Tgenecity getTgenecity() {
        return tgenecity;
    }

    public void setTgenecity(Tgenecity tgenecity) {
        this.tgenecity = tgenecity;
    }

    public Tgeneparroquia getTgeneparroquia() {
        return tgeneparroquia;
    }

    public void setTgeneparroquia(Tgeneparroquia tgeneparroquia) {
        this.tgeneparroquia = tgeneparroquia;
    }

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

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