/*
 * 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.Date;
import javax.persistence.Basic;
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.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.xml.bind.annotation.XmlRootElement;

/**
 *
 * @author developer2
 */
@Entity
@Table(name="COMACO.TSAFEUSERPROFILE")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "Tsafeuserprofile.findAll", query = "SELECT t FROM Tsafeuserprofile t"),
    @NamedQuery(name = "Tsafeuserprofile.findByUsercode", query = "SELECT t FROM Tsafeuserprofile t WHERE t.tsafeuserprofilePK.usercode = :usercode"),
    @NamedQuery(name = "Tsafeuserprofile.findByProfilecode", query = "SELECT t FROM Tsafeuserprofile t WHERE t.tsafeuserprofilePK.profilecode = :profilecode"),
    @NamedQuery(name = "Tsafeuserprofile.findByDateto", query = "SELECT t FROM Tsafeuserprofile t WHERE t.tsafeuserprofilePK.dateto = :dateto"),
    @NamedQuery(name = "Tsafeuserprofile.findByDatefrom", query = "SELECT t FROM Tsafeuserprofile t WHERE t.datefrom = :datefrom"),
    @NamedQuery(name = "Tsafeuserprofile.findByIngressuser", query = "SELECT t FROM Tsafeuserprofile t WHERE t.ingressuser = :ingressuser"),
    @NamedQuery(name = "Tsafeuserprofile.findByModifyuser", query = "SELECT t FROM Tsafeuserprofile t WHERE t.modifyuser = :modifyuser")})
public class Tsafeuserprofile implements Serializable {

    private static final long serialVersionUID = 1L;
    @EmbeddedId
    protected TsafeuserprofilePK tsafeuserprofilePK;
    @Basic(optional = false)
    @Column(name = "DATEFROM")
    @Temporal(TemporalType.TIMESTAMP)
    private Date datefrom;
    @Column(name = "INGRESSUSER")
    private String ingressuser;
    @Column(name = "MODIFYUSER")
    private String modifyuser;
    @JoinColumn(name = "PROFILECODE", referencedColumnName = "PROFILECODE", insertable = false, updatable = false)
    @ManyToOne(optional = false)
    private Tsafeprofile tsafeprofile;
    @JoinColumn(name = "USERCODE", referencedColumnName = "USERCODE", insertable = false, updatable = false)
    @ManyToOne(optional = false)
    private Tsafeuser tsafeuser;

    public Tsafeuserprofile() {
    }

    public Tsafeuserprofile(TsafeuserprofilePK tsafeuserprofilePK) {
        this.tsafeuserprofilePK = tsafeuserprofilePK;
    }

    public Tsafeuserprofile(TsafeuserprofilePK tsafeuserprofilePK, Date datefrom) {
        this.tsafeuserprofilePK = tsafeuserprofilePK;
        this.datefrom = datefrom;
    }

    public Tsafeuserprofile(String usercode, String profilecode, Date dateto) {
        this.tsafeuserprofilePK = new TsafeuserprofilePK(usercode, profilecode, dateto);
    }

    public TsafeuserprofilePK getTsafeuserprofilePK() {
        return tsafeuserprofilePK;
    }

    public void setTsafeuserprofilePK(TsafeuserprofilePK tsafeuserprofilePK) {
        this.tsafeuserprofilePK = tsafeuserprofilePK;
    }

    public Date getDatefrom() {
        return datefrom;
    }

    public void setDatefrom(Date datefrom) {
        this.datefrom = datefrom;
    }

    public String getIngressuser() {
        return ingressuser;
    }

    public void setIngressuser(String ingressuser) {
        this.ingressuser = ingressuser;
    }

    public String getModifyuser() {
        return modifyuser;
    }

    public void setModifyuser(String modifyuser) {
        this.modifyuser = modifyuser;
    }

    public Tsafeprofile getTsafeprofile() {
        return tsafeprofile;
    }

    public void setTsafeprofile(Tsafeprofile tsafeprofile) {
        this.tsafeprofile = tsafeprofile;
    }

    public Tsafeuser getTsafeuser() {
        return tsafeuser;
    }

    public void setTsafeuser(Tsafeuser tsafeuser) {
        this.tsafeuser = tsafeuser;
    }

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

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