/*
 * 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.JoinColumn;
import javax.persistence.ManyToOne;
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 = "annee_fiscale")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "AnneeFiscale.findAll", query = "SELECT a FROM AnneeFiscale a"),
    @NamedQuery(name = "AnneeFiscale.findByAnnee", query = "SELECT a FROM AnneeFiscale a WHERE a.annee = :annee"),
    @NamedQuery(name = "AnneeFiscale.findByCloture", query = "SELECT a FROM AnneeFiscale a WHERE a.cloture = :cloture"),
    @NamedQuery(name = "AnneeFiscale.findByActif", query = "SELECT a FROM AnneeFiscale a WHERE a.actif = :actif"),
    @NamedQuery(name = "AnneeFiscale.findByCodeLetterage", query = "SELECT a FROM AnneeFiscale a WHERE a.codeLetterage = :codeLetterage")})
public class AnneeFiscale implements Serializable {

    @Size(max = 255)
    @Column(name = "code_letterage")
    private String codeLetterage;

    private static final long serialVersionUID = 1L;
    @Id
    @Basic(optional = false)
    @NotNull
    @Column(name = "annee")
    private Integer annee;
    @Column(name = "cloture")
    private Boolean cloture;
    @Column(name = "actif")
    private Boolean actif;
    @JoinColumn(name = "fk_etablissement", referencedColumnName = "id_etab_stock")
    @ManyToOne
    private Etablissement fkEtablissement;
    @OneToMany(mappedBy = "fkAnneeFiscale")
    private List<MouvementTier> mouvementTierList;
    @OneToMany(mappedBy = "fkAnneeFiscale")
    private List<Mouvement> mouvementList;

    public AnneeFiscale() {
    }

    public AnneeFiscale(Integer annee) {
        this.annee = annee;
    }

    public Integer getAnnee() {
        return annee;
    }

    public void setAnnee(Integer annee) {
        this.annee = annee;
    }

    public Boolean getCloture() {
        return cloture;
    }

    public void setCloture(Boolean cloture) {
        this.cloture = cloture;
    }

    public Boolean getActif() {
        return actif;
    }

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

    public String getCodeLetterage() {
        return codeLetterage;
    }

    public void setCodeLetterage(String codeLetterage) {
        this.codeLetterage = codeLetterage;
    }

    public Etablissement getFkEtablissement() {
        return fkEtablissement;
    }

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

    @XmlTransient
    public List<MouvementTier> getMouvementTierList() {
        return mouvementTierList;
    }

    public void setMouvementTierList(List<MouvementTier> mouvementTierList) {
        this.mouvementTierList = mouvementTierList;
    }

    @XmlTransient
    public List<Mouvement> getMouvementList() {
        return mouvementList;
    }

    public void setMouvementList(List<Mouvement> mouvementList) {
        this.mouvementList = mouvementList;
    }

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

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

    
    
}
