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

/**
 *
 * @author FORCE TECH
 */
@Entity
@Table(name = "banque")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "Banque.findAll", query = "SELECT b FROM Banque b"),
    @NamedQuery(name = "Banque.findById", query = "SELECT b FROM Banque b WHERE b.id = :id"),
    @NamedQuery(name = "Banque.findByNom", query = "SELECT b FROM Banque b WHERE b.nom = :nom"),
    @NamedQuery(name = "Banque.findByAbreviation", query = "SELECT b FROM Banque b WHERE b.abreviation = :abreviation")})
public class Banque implements Serializable {

    @Size(max = 50)
    @Column(name = "nom")
    private String nom;
    @Size(max = 10)
    @Column(name = "abreviation")
    private String abreviation;

    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "id")
    private Integer id;
    @OneToMany(mappedBy = "fkBanque")
    private List<Agence> agenceList;
    @OneToMany(mappedBy = "fkBanque")
    private List<CompteComptable> compteComptableList;

    public Banque() {
    }

    public Banque(Integer id) {
        this.id = id;
    }

    public Integer getId() {
        return id;
    }

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


    @XmlTransient
    public List<Agence> getAgenceList() {
        return agenceList;
    }

    public void setAgenceList(List<Agence> agenceList) {
        this.agenceList = agenceList;
    }

    @XmlTransient
    public List<CompteComptable> getCompteComptableList() {
        return compteComptableList;
    }

    public void setCompteComptableList(List<CompteComptable> compteComptableList) {
        this.compteComptableList = compteComptableList;
    }

    @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 Banque)) {
            return false;
        }
        Banque other = (Banque) 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.Banque_1[ id=" + id + " ]";
    }

    public String getNom() {
        return nom;
    }

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

    public String getAbreviation() {
        return abreviation;
    }

    public void setAbreviation(String abreviation) {
        this.abreviation = abreviation;
    }
    
}
