/*
 * 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.util.Collection;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.OneToOne;
import javax.persistence.Table;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;

/**
 *
 * @author developer2
 */
@Entity
@Table(name="COMACO.TARMGUARDIAS")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "Tarmguardias.findAll", query = "SELECT t FROM Tarmguardias t"),
    @NamedQuery(name = "Tarmguardias.findByCguardia", query = "SELECT t FROM Tarmguardias t WHERE t.cguardia = :cguardia"),
    @NamedQuery(name = "Tarmguardias.findByEstado", query = "SELECT t FROM Tarmguardias t WHERE t.estado = :estado")})
public class Tarmguardias implements Serializable {

    private static final long serialVersionUID = 1L;
    @Id
    @Basic(optional = false)
    @Column(name = "CGUARDIA")
    private Long cguardia;
    @Column(name = "ESTADO")
    private String estado;
    @JoinColumn(name = "CEMPRESA", referencedColumnName = "PERSONCODE")
    @ManyToOne
    private Tcustperson cempresa;
    @JoinColumn(name = "CGUARDIA", referencedColumnName = "PERSONCODE", insertable = false, updatable = false)
    @OneToOne(optional = false)
    private Tcustperson tcustperson;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "tarmguardias")
    private Collection<Tarmsolicitudguardias> tarmsolicitudguardiasCollection;

    public Tarmguardias() {
    }

    public Tarmguardias(Long cguardia) {
        this.cguardia = cguardia;
    }

    public Long getCguardia() {
        return cguardia;
    }

    public void setCguardia(Long cguardia) {
        this.cguardia = cguardia;
    }

    public String getEstado() {
        return estado;
    }

    public void setEstado(String estado) {
        this.estado = estado;
    }

    public Tcustperson getCempresa() {
        return cempresa;
    }

    public void setCempresa(Tcustperson cempresa) {
        this.cempresa = cempresa;
    }

    public Tcustperson getTcustperson() {
        return tcustperson;
    }

    public void setTcustperson(Tcustperson tcustperson) {
        this.tcustperson = tcustperson;
    }

    @XmlTransient
    public Collection<Tarmsolicitudguardias> getTarmsolicitudguardiasCollection() {
        return tarmsolicitudguardiasCollection;
    }

    public void setTarmsolicitudguardiasCollection(Collection<Tarmsolicitudguardias> tarmsolicitudguardiasCollection) {
        this.tarmsolicitudguardiasCollection = tarmsolicitudguardiasCollection;
    }

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

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