/*
 * 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.CascadeType;
import javax.persistence.Column;
import javax.persistence.EmbeddedId;
import javax.persistence.Entity;
import javax.persistence.JoinColumn;
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.TGENEAREA")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "Tgenearea.findAll", query = "SELECT t FROM Tgenearea t"),
    @NamedQuery(name = "Tgenearea.findByCompanycode", query = "SELECT t FROM Tgenearea t WHERE t.tgeneareaPK.companycode = :companycode"),
    @NamedQuery(name = "Tgenearea.findByAreacode", query = "SELECT t FROM Tgenearea t WHERE t.tgeneareaPK.areacode = :areacode"),
    @NamedQuery(name = "Tgenearea.findByRecordversion", query = "SELECT t FROM Tgenearea t WHERE t.recordversion = :recordversion"),
    @NamedQuery(name = "Tgenearea.findByDescripction", query = "SELECT t FROM Tgenearea t WHERE t.descripction = :descripction")})
public class Tgenearea implements Serializable {

    private static final long serialVersionUID = 1L;
    @EmbeddedId
    protected TgeneareaPK tgeneareaPK;
    @Column(name = "RECORDVERSION")
    private BigInteger recordversion;
    @Column(name = "DESCRIPCTION")
    private String descripction;
    @OneToMany(mappedBy = "tgenearea")
    private Collection<Tsafeuserdetail> tsafeuserdetailCollection;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "tgenearea")
    private Collection<Tsafeterminal> tsafeterminalCollection;
    @JoinColumn(name = "COMPANYCODE", referencedColumnName = "COMPANYCODE", insertable = false, updatable = false)
    @ManyToOne(optional = false)
    private Tgenecompany tgenecompany;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "tgenearea")
    private Collection<Tgenscheduleparameters> tgenscheduleparametersCollection;

    public Tgenearea() {
    }

    public Tgenearea(TgeneareaPK tgeneareaPK) {
        this.tgeneareaPK = tgeneareaPK;
    }

    public Tgenearea(long companycode, short areacode) {
        this.tgeneareaPK = new TgeneareaPK(companycode, areacode);
    }

    public TgeneareaPK getTgeneareaPK() {
        return tgeneareaPK;
    }

    public void setTgeneareaPK(TgeneareaPK tgeneareaPK) {
        this.tgeneareaPK = tgeneareaPK;
    }

    public BigInteger getRecordversion() {
        return recordversion;
    }

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

    public String getDescripction() {
        return descripction;
    }

    public void setDescripction(String descripction) {
        this.descripction = descripction;
    }

    @XmlTransient
    public Collection<Tsafeuserdetail> getTsafeuserdetailCollection() {
        return tsafeuserdetailCollection;
    }

    public void setTsafeuserdetailCollection(Collection<Tsafeuserdetail> tsafeuserdetailCollection) {
        this.tsafeuserdetailCollection = tsafeuserdetailCollection;
    }

    @XmlTransient
    public Collection<Tsafeterminal> getTsafeterminalCollection() {
        return tsafeterminalCollection;
    }

    public void setTsafeterminalCollection(Collection<Tsafeterminal> tsafeterminalCollection) {
        this.tsafeterminalCollection = tsafeterminalCollection;
    }

    public Tgenecompany getTgenecompany() {
        return tgenecompany;
    }

    public void setTgenecompany(Tgenecompany tgenecompany) {
        this.tgenecompany = tgenecompany;
    }

    @XmlTransient
    public Collection<Tgenscheduleparameters> getTgenscheduleparametersCollection() {
        return tgenscheduleparametersCollection;
    }

    public void setTgenscheduleparametersCollection(Collection<Tgenscheduleparameters> tgenscheduleparametersCollection) {
        this.tgenscheduleparametersCollection = tgenscheduleparametersCollection;
    }

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

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