/*
 * 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.triz.trizservice.modeles;

import java.io.Serializable;
import java.util.Date;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
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.validation.constraints.Size;
import javax.xml.bind.annotation.XmlRootElement;

/**
 *
 * @author PC
 */
@Entity
@Table(name = "service_historique_connection")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "ServicehistoriqueConnection.findAll", query = "SELECT s FROM ServicehistoriqueConnection s"),
    @NamedQuery(name = "ServicehistoriqueConnection.findById", query = "SELECT s FROM ServicehistoriqueConnection s WHERE s.id = :id"),
    @NamedQuery(name = "ServicehistoriqueConnection.findByDate", query = "SELECT s FROM ServicehistoriqueConnection s WHERE s.date = :date"),
    @NamedQuery(name = "ServicehistoriqueConnection.findByHeur", query = "SELECT s FROM ServicehistoriqueConnection s WHERE s.heur = :heur"),
    @NamedQuery(name = "ServicehistoriqueConnection.findByAdresseIP", query = "SELECT s FROM ServicehistoriqueConnection s WHERE s.adresseIp = :adresseIp")})
public class ServicehistoriqueConnection implements Serializable {

    @Size(max = 2147483647)
    @Column(name = "adresse_ip")
    private String adresseIp;

    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "id")
    private Long id;
    @Column(name = "date")
    @Temporal(TemporalType.DATE)
    private Date date;
    @Column(name = "heur")
    @Temporal(TemporalType.TIME)
    private Date heur;
    @JoinColumn(name = "fk_user", referencedColumnName = "userid")
    @ManyToOne
    private ServiceUser fkUser;
    @JoinColumn(name = "fk_etablissemnt", referencedColumnName = "id_etab_stock")
    @ManyToOne
    private Etablissement fkEtablissement;

    public ServicehistoriqueConnection() {
    }

    public ServicehistoriqueConnection(Long id) {
        this.id = id;
    }

    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public Date getDate() {
        return date;
    }

    public void setDate(Date date) {
        this.date = date;
    }

    public Date getHeur() {
        return heur;
    }

    public void setHeur(Date heur) {
        this.heur = heur;
    }

    public ServiceUser getFkUser() {
        return fkUser;
    }

    public void setFkUser(ServiceUser fkUser) {
        this.fkUser = fkUser;
    }

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

    @Override
    public String toString() {
        return "com.triz.trizservice.modeles.ServicehistoriqueConnection[ id=" + id + " ]";
    }

    public String getAdresseIp() {
        return adresseIp;
    }

    public void setAdresseIp(String adresseIp) {
        this.adresseIp = adresseIp;
    }

    public Etablissement getFkEtablissement() {
        return fkEtablissement;
    }

    public void setFkEtablissement(Etablissement fkEtablissement) {
        this.fkEtablissement = fkEtablissement;
    }

   
 

  

}
