/*
 * 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.List;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;

/**
 *
 * @author FORCE TECH
 */
@Entity
@Table(name = "etablissement", catalog = "triz_tresorie", schema = "public")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "Etablissement.findAll", query = "SELECT e FROM Etablissement e"),
    @NamedQuery(name = "Etablissement.findByIdEtabStock", query = "SELECT e FROM Etablissement e WHERE e.idEtabStock = :idEtabStock"),
    @NamedQuery(name = "Etablissement.findByNom", query = "SELECT e FROM Etablissement e WHERE e.nom = :nom"),
    @NamedQuery(name = "Etablissement.findByActif", query = "SELECT e FROM Etablissement e WHERE e.actif = :actif")})
public class Etablissement implements Serializable {

    @Size(max = 50)
    @Column(name = "nom")
    private String nom;
    @Size(max = 5)
    @Column(name = "actif")
    private String actif;

    @Id()
    @Basic(optional = false)
    @NotNull
    @Size(min = 1, max = 50)
    @Column(name = "id_etab_stock")
    private String idEtabStock;
    @OneToMany(mappedBy = "fkEtablissement")
    private List<Tier> tierList;
    @OneToMany(mappedBy = "fkEtablissement")
    private List<AnneeFiscale> anneeFiscaleList;
 
    @OneToMany(mappedBy = "fkEtablissement")
    private List<ServiceEtablissementUser> serviceEtablissementUserList;
    @OneToMany(mappedBy = "fkEtablissement")
    private List<ServicehistoriqueConnection> servicehistoriqueConnectionList;

    private static final long serialVersionUID = 1L;
    
    @OneToMany(mappedBy = "fkEtablissement")
    private List<Tresorie> tresorieList;

    public Etablissement() {
    }

    public Etablissement(String idEtabStock) {
        this.idEtabStock = idEtabStock;
    }

    public String getIdEtabStock() {
        return idEtabStock;
    }

    public void setIdEtabStock(String idEtabStock) {
        this.idEtabStock = idEtabStock;
    }


    @XmlTransient
    public List<Tier> getTierList() {
        return tierList;
    }

    public void setTierList(List<Tier> tierList) {
        this.tierList = tierList;
    }

    @XmlTransient
    public List<AnneeFiscale> getAnneeFiscaleList() {
        return anneeFiscaleList;
    }

    public void setAnneeFiscaleList(List<AnneeFiscale> anneeFiscaleList) {
        this.anneeFiscaleList = anneeFiscaleList;
    }

   

    @XmlTransient
    public List<Tresorie> getTresorieList() {
        return tresorieList;
    }

    public void setTresorieList(List<Tresorie> tresorieList) {
        this.tresorieList = tresorieList;
    }

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

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


    @XmlTransient
    public List<ServiceEtablissementUser> getServiceEtablissementUserList() {
        return serviceEtablissementUserList;
    }

    public void setServiceEtablissementUserList(List<ServiceEtablissementUser> serviceEtablissementUserList) {
        this.serviceEtablissementUserList = serviceEtablissementUserList;
    }

    @XmlTransient
    public List<ServicehistoriqueConnection> getServicehistoriqueConnectionList() {
        return servicehistoriqueConnectionList;
    }

    public void setServicehistoriqueConnectionList(List<ServicehistoriqueConnection> servicehistoriqueConnectionList) {
        this.servicehistoriqueConnectionList = servicehistoriqueConnectionList;
    }

  
    public String getNom() {
        return nom;
    }

    public void setNom(String nom) {
        this.nom = nom;
    }

    public String getActif() {
        return actif;
    }

    public void setActif(String actif) {
        this.actif = actif;
    }
    
}
