/*
 * 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.Collection;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
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.OneToMany;
import javax.persistence.Table;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;

/**
 *
 * @author developer2
 */
@Entity
@Table(name="COMACO.TGENECITY")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "Tgenecity.findAll", query = "SELECT t FROM Tgenecity t"),
    @NamedQuery(name = "Tgenecity.findByCountrycode", query = "SELECT t FROM Tgenecity t WHERE t.tgenecityPK.countrycode = :countrycode"),
    @NamedQuery(name = "Tgenecity.findByProvincecode", query = "SELECT t FROM Tgenecity t WHERE t.tgenecityPK.provincecode = :provincecode"),
    @NamedQuery(name = "Tgenecity.findByCantoncode", query = "SELECT t FROM Tgenecity t WHERE t.tgenecityPK.cantoncode = :cantoncode"),
    @NamedQuery(name = "Tgenecity.findByCitycode", query = "SELECT t FROM Tgenecity t WHERE t.tgenecityPK.citycode = :citycode"),
    @NamedQuery(name = "Tgenecity.findByRecordversion", query = "SELECT t FROM Tgenecity t WHERE t.recordversion = :recordversion"),
    @NamedQuery(name = "Tgenecity.findByDescription", query = "SELECT t FROM Tgenecity t WHERE t.description = :description")})
public class Tgenecity implements Serializable {

    private static final long serialVersionUID = 1L;
    @EmbeddedId
    protected TgenecityPK tgenecityPK;
    @Column(name = "RECORDVERSION")
    private BigInteger recordversion;
    @Basic(optional = false)
    @Column(name = "DESCRIPTION")
    private String description;
    @OneToMany(mappedBy = "tgenecity")
    private Collection<Tgeneoffice> tgeneofficeCollection;
    @OneToMany(mappedBy = "tgenecity")
    private Collection<Tcustpersonaddress> tcustpersonaddressCollection;
    @OneToMany(mappedBy = "tgenecity")
    private Collection<Tarmarmas> tarmarmasCollection;
    @JoinColumns({
        @JoinColumn(name = "COUNTRYCODE", referencedColumnName = "COUNTRYCODE", insertable = false, updatable = false),
        @JoinColumn(name = "PROVINCECODE", referencedColumnName = "PROVINCECODE", insertable = false, updatable = false),
        @JoinColumn(name = "CANTONCODE", referencedColumnName = "CANTONCODE", insertable = false, updatable = false)})
    @ManyToOne(optional = false)
    private Tgenecanton tgenecanton;
    @OneToMany(mappedBy = "tgenecity")
    private Collection<Tcustpeople> tcustpeopleCollection;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "tgenecity")
    private Collection<Tgenecitydesc> tgenecitydescCollection;
    @OneToMany(mappedBy = "tgenecity")
    private Collection<Tarmsitioalmacenamiento> tarmsitioalmacenamientoCollection;
    @OneToMany(mappedBy = "tgenecity")
    private Collection<Tarmagenciasucursal> tarmagenciasucursalCollection;
    @OneToMany(mappedBy = "tgenecity")
    private Collection<Tarmdecomiso> tarmdecomisoCollection;
    @OneToMany(mappedBy = "tgenecity")
    private Collection<Tcustpeoplerealassets> tcustpeoplerealassetsCollection;
    @OneToMany(mappedBy = "tgenecity")
    private Collection<Tarmcustodiatemporal> tarmcustodiatemporalCollection;

    public Tgenecity() {
    }

    public Tgenecity(TgenecityPK tgenecityPK) {
        this.tgenecityPK = tgenecityPK;
    }

    public Tgenecity(TgenecityPK tgenecityPK, String description) {
        this.tgenecityPK = tgenecityPK;
        this.description = description;
    }

    public Tgenecity(String countrycode, String provincecode, String cantoncode, String citycode) {
        this.tgenecityPK = new TgenecityPK(countrycode, provincecode, cantoncode, citycode);
    }

    public TgenecityPK getTgenecityPK() {
        return tgenecityPK;
    }

    public void setTgenecityPK(TgenecityPK tgenecityPK) {
        this.tgenecityPK = tgenecityPK;
    }

    public BigInteger getRecordversion() {
        return recordversion;
    }

    public void setRecordversion(BigInteger recordversion) {
        this.recordversion = recordversion;
    }

    public String getDescription() {
        return description;
    }

    public void setDescription(String description) {
        this.description = description;
    }

    @XmlTransient
    public Collection<Tgeneoffice> getTgeneofficeCollection() {
        return tgeneofficeCollection;
    }

    public void setTgeneofficeCollection(Collection<Tgeneoffice> tgeneofficeCollection) {
        this.tgeneofficeCollection = tgeneofficeCollection;
    }

    @XmlTransient
    public Collection<Tcustpersonaddress> getTcustpersonaddressCollection() {
        return tcustpersonaddressCollection;
    }

    public void setTcustpersonaddressCollection(Collection<Tcustpersonaddress> tcustpersonaddressCollection) {
        this.tcustpersonaddressCollection = tcustpersonaddressCollection;
    }

    @XmlTransient
    public Collection<Tarmarmas> getTarmarmasCollection() {
        return tarmarmasCollection;
    }

    public void setTarmarmasCollection(Collection<Tarmarmas> tarmarmasCollection) {
        this.tarmarmasCollection = tarmarmasCollection;
    }

    public Tgenecanton getTgenecanton() {
        return tgenecanton;
    }

    public void setTgenecanton(Tgenecanton tgenecanton) {
        this.tgenecanton = tgenecanton;
    }

    @XmlTransient
    public Collection<Tcustpeople> getTcustpeopleCollection() {
        return tcustpeopleCollection;
    }

    public void setTcustpeopleCollection(Collection<Tcustpeople> tcustpeopleCollection) {
        this.tcustpeopleCollection = tcustpeopleCollection;
    }

    @XmlTransient
    public Collection<Tgenecitydesc> getTgenecitydescCollection() {
        return tgenecitydescCollection;
    }

    public void setTgenecitydescCollection(Collection<Tgenecitydesc> tgenecitydescCollection) {
        this.tgenecitydescCollection = tgenecitydescCollection;
    }

    @XmlTransient
    public Collection<Tarmsitioalmacenamiento> getTarmsitioalmacenamientoCollection() {
        return tarmsitioalmacenamientoCollection;
    }

    public void setTarmsitioalmacenamientoCollection(Collection<Tarmsitioalmacenamiento> tarmsitioalmacenamientoCollection) {
        this.tarmsitioalmacenamientoCollection = tarmsitioalmacenamientoCollection;
    }

    @XmlTransient
    public Collection<Tarmagenciasucursal> getTarmagenciasucursalCollection() {
        return tarmagenciasucursalCollection;
    }

    public void setTarmagenciasucursalCollection(Collection<Tarmagenciasucursal> tarmagenciasucursalCollection) {
        this.tarmagenciasucursalCollection = tarmagenciasucursalCollection;
    }

    @XmlTransient
    public Collection<Tarmdecomiso> getTarmdecomisoCollection() {
        return tarmdecomisoCollection;
    }

    public void setTarmdecomisoCollection(Collection<Tarmdecomiso> tarmdecomisoCollection) {
        this.tarmdecomisoCollection = tarmdecomisoCollection;
    }

    @XmlTransient
    public Collection<Tcustpeoplerealassets> getTcustpeoplerealassetsCollection() {
        return tcustpeoplerealassetsCollection;
    }

    public void setTcustpeoplerealassetsCollection(Collection<Tcustpeoplerealassets> tcustpeoplerealassetsCollection) {
        this.tcustpeoplerealassetsCollection = tcustpeoplerealassetsCollection;
    }

    @XmlTransient
    public Collection<Tarmcustodiatemporal> getTarmcustodiatemporalCollection() {
        return tarmcustodiatemporalCollection;
    }

    public void setTarmcustodiatemporalCollection(Collection<Tarmcustodiatemporal> tarmcustodiatemporalCollection) {
        this.tarmcustodiatemporalCollection = tarmcustodiatemporalCollection;
    }

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

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