/*
 * 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.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.TSAFETERMINAL")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "Tsafeterminal.findAll", query = "SELECT t FROM Tsafeterminal t"),
    @NamedQuery(name = "Tsafeterminal.findByTerminalcode", query = "SELECT t FROM Tsafeterminal t WHERE t.tsafeterminalPK.terminalcode = :terminalcode"),
    @NamedQuery(name = "Tsafeterminal.findByCompanycode", query = "SELECT t FROM Tsafeterminal t WHERE t.tsafeterminalPK.companycode = :companycode"),
    @NamedQuery(name = "Tsafeterminal.findByRecordversion", query = "SELECT t FROM Tsafeterminal t WHERE t.recordversion = :recordversion"),
    @NamedQuery(name = "Tsafeterminal.findByIpaddress", query = "SELECT t FROM Tsafeterminal t WHERE t.ipaddress = :ipaddress"),
    @NamedQuery(name = "Tsafeterminal.findByMacaddress", query = "SELECT t FROM Tsafeterminal t WHERE t.macaddress = :macaddress"),
    @NamedQuery(name = "Tsafeterminal.findBySliptprinter", query = "SELECT t FROM Tsafeterminal t WHERE t.sliptprinter = :sliptprinter")})
public class Tsafeterminal implements Serializable {

    private static final long serialVersionUID = 1L;
    @EmbeddedId
    protected TsafeterminalPK tsafeterminalPK;
    @Column(name = "RECORDVERSION")
    private BigInteger recordversion;
    @Column(name = "IPADDRESS")
    private String ipaddress;
    @Column(name = "MACADDRESS")
    private String macaddress;
    @Column(name = "SLIPTPRINTER")
    private String sliptprinter;
    @OneToMany(mappedBy = "tsafeterminal")
    private Collection<Tsafeuserdetail> tsafeuserdetailCollection;
    @JoinColumns({
        @JoinColumn(name = "COMPANYCODE", referencedColumnName = "COMPANYCODE", insertable = false, updatable = false),
        @JoinColumn(name = "AREACODE", referencedColumnName = "AREACODE")})
    @ManyToOne(optional = false)
    private Tgenearea tgenearea;
    @JoinColumns({
        @JoinColumn(name = "OFFICECODE", referencedColumnName = "OFFICECODE"),
        @JoinColumn(name = "BRANCHCODE", referencedColumnName = "BRANCHCODE"),
        @JoinColumn(name = "COMPANYCODE", referencedColumnName = "COMPANYCODE", insertable = false, updatable = false)})
    @ManyToOne(optional = false)
    private Tgeneoffice tgeneoffice;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "tsafeterminal")
    private Collection<Tgenscheduleparameters> tgenscheduleparametersCollection;

    public Tsafeterminal() {
    }

    public Tsafeterminal(TsafeterminalPK tsafeterminalPK) {
        this.tsafeterminalPK = tsafeterminalPK;
    }

    public Tsafeterminal(String terminalcode, long companycode) {
        this.tsafeterminalPK = new TsafeterminalPK(terminalcode, companycode);
    }

    public TsafeterminalPK getTsafeterminalPK() {
        return tsafeterminalPK;
    }

    public void setTsafeterminalPK(TsafeterminalPK tsafeterminalPK) {
        this.tsafeterminalPK = tsafeterminalPK;
    }

    public BigInteger getRecordversion() {
        return recordversion;
    }

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

    public String getIpaddress() {
        return ipaddress;
    }

    public void setIpaddress(String ipaddress) {
        this.ipaddress = ipaddress;
    }

    public String getMacaddress() {
        return macaddress;
    }

    public void setMacaddress(String macaddress) {
        this.macaddress = macaddress;
    }

    public String getSliptprinter() {
        return sliptprinter;
    }

    public void setSliptprinter(String sliptprinter) {
        this.sliptprinter = sliptprinter;
    }

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

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

    public Tgenearea getTgenearea() {
        return tgenearea;
    }

    public void setTgenearea(Tgenearea tgenearea) {
        this.tgenearea = tgenearea;
    }

    public Tgeneoffice getTgeneoffice() {
        return tgeneoffice;
    }

    public void setTgeneoffice(Tgeneoffice tgeneoffice) {
        this.tgeneoffice = tgeneoffice;
    }

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

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

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

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