/*
 * 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 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.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.validation.constraints.Size;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;

/**
 *
 * @author FORCE TECH
 */
@Entity
@Table(name = "tier")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "Tier.findAll", query = "SELECT t FROM Tier t"),
    @NamedQuery(name = "Tier.findById", query = "SELECT t FROM Tier t WHERE t.id = :id"),
    @NamedQuery(name = "Tier.findByCode", query = "SELECT t FROM Tier t WHERE t.code = :code"),
    @NamedQuery(name = "Tier.findByDesignation", query = "SELECT t FROM Tier t WHERE t.designation = :designation"),
    @NamedQuery(name = "Tier.findByAddresse", query = "SELECT t FROM Tier t WHERE t.addresse = :addresse"),
    @NamedQuery(name = "Tier.findByNumRC", query = "SELECT t FROM Tier t WHERE t.numRC = :numRC"),
    @NamedQuery(name = "Tier.findByNif", query = "SELECT t FROM Tier t WHERE t.nif = :nif"),
    @NamedQuery(name = "Tier.findByArticleImpo", query = "SELECT t FROM Tier t WHERE t.articleImpo = :articleImpo"),
    @NamedQuery(name = "Tier.findByMinLiq", query = "SELECT t FROM Tier t WHERE t.minLiq = :minLiq"),
    @NamedQuery(name = "Tier.findByMaxLiq", query = "SELECT t FROM Tier t WHERE t.maxLiq = :maxLiq"),
    @NamedQuery(name = "Tier.findBySoldInitial", query = "SELECT t FROM Tier t WHERE t.soldInitial = :soldInitial"),
    @NamedQuery(name = "Tier.findByDateSoldeInit", query = "SELECT t FROM Tier t WHERE t.dateSoldeInit = :dateSoldeInit"),
    @NamedQuery(name = "Tier.findByDureeMax", query = "SELECT t FROM Tier t WHERE t.dureeMax = :dureeMax"),
    @NamedQuery(name = "Tier.findByNumCompteTier", query = "SELECT t FROM Tier t WHERE t.numCompteTier = :numCompteTier"),
    @NamedQuery(name = "Tier.findByBp", query = "SELECT t FROM Tier t WHERE t.bp = :bp"),
    @NamedQuery(name = "Tier.findByNis", query = "SELECT t FROM Tier t WHERE t.nis = :nis"),
    @NamedQuery(name = "Tier.findByIdStockFournisseur", query = "SELECT t FROM Tier t WHERE t.idStockFournisseur = :idStockFournisseur"),
    @NamedQuery(name = "Tier.findByIdStockClient", query = "SELECT t FROM Tier t WHERE t.idStockClient = :idStockClient"),
    @NamedQuery(name = "Tier.findByIsDeleted", query = "SELECT t FROM Tier t WHERE t.isDeleted = :isDeleted")})
public class Tier implements Serializable {

    @Size(max = 10)
    @Column(name = "code")
    private String code;
    @Size(max = 50)
    @Column(name = "designation")
    private String designation;
    @Size(max = 1000)
    @Column(name = "addresse")
    private String addresse;
    @Size(max = 50)
    @Column(name = "num_rc")
    private String numRc;
    @Size(max = 50)
    @Column(name = "nif")
    private String nif;
    @Size(max = 50)
    @Column(name = "article_impo")
    private String articleImpo;
    @Size(max = 50)
    @Column(name = "num_compte_tier")
    private String numCompteTier;
    @Size(max = 50)
    @Column(name = "bp")
    private String bp;
    @Size(max = 50)
    @Column(name = "nis")
    private String nis;
    @Size(max = 50)
    @Column(name = "id_stock_fournisseur")
    private String idStockFournisseur;
    @Size(max = 50)
    @Column(name = "id_stock_client")
    private String idStockClient;
    @Size(max = 5)
    @Column(name = "is_deleted")
    private String isDeleted;
    // @Max(value=?)  @Min(value=?)//if you know range of your decimal fields consider using these annotations to enforce field validation
    @Column(name = "min_liq")
    private Double minLiq;
    @Column(name = "max_liq")
    private Double maxLiq;
    @Column(name = "sold_initial")
    private Double soldInitial;
    @Column(name = "date_solde_init")
    @Temporal(TemporalType.DATE)
    private Date dateSoldeInit;
    @Column(name = "duree_max")
    private Integer dureeMax;

    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "id")
    private Integer id;
    @Size(max = 50)
    @Column(name = "numRC")
    private String numRC;
  
    @JoinColumn(name = "fk_compte_comptable", referencedColumnName = "id")
    @ManyToOne
    private CompteComptable fkCompteComptable;
    @JoinColumn(name = "fk_etablissement", referencedColumnName = "id_etab_stock")
    @ManyToOne
    private Etablissement fkEtablissement;
    @OneToMany(mappedBy = "fkTier")
    private List<MouvementTier> mouvementTierList;
    @OneToMany(mappedBy = "fkTier")
    private List<Mouvement> mouvementList;

    public Tier() {
    }

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

    public Integer getId() {
        return id;
    }

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


    public String getNumRC() {
        return numRC;
    }

    public void setNumRC(String numRC) {
        this.numRC = numRC;
    }


    public String getArticleImpo() {
        return articleImpo;
    }

    public void setArticleImpo(String articleImpo) {
        this.articleImpo = articleImpo;
    }

    public Double getMinLiq() {
        return minLiq;
    }

    public void setMinLiq(Double minLiq) {
        this.minLiq = minLiq;
    }

    public Double getMaxLiq() {
        return maxLiq;
    }

    public void setMaxLiq(Double maxLiq) {
        this.maxLiq = maxLiq;
    }

    public Double getSoldInitial() {
        return soldInitial;
    }

    public void setSoldInitial(Double soldInitial) {
        this.soldInitial = soldInitial;
    }

    public Date getDateSoldeInit() {
        return dateSoldeInit;
    }

    public void setDateSoldeInit(Date dateSoldeInit) {
        this.dateSoldeInit = dateSoldeInit;
    }

    public Integer getDureeMax() {
        return dureeMax;
    }

    public void setDureeMax(Integer dureeMax) {
        this.dureeMax = dureeMax;
    }

    public String getNumCompteTier() {
        return numCompteTier;
    }

    public void setNumCompteTier(String numCompteTier) {
        this.numCompteTier = numCompteTier;
    }


    public String getIdStockFournisseur() {
        return idStockFournisseur;
    }

    public void setIdStockFournisseur(String idStockFournisseur) {
        this.idStockFournisseur = idStockFournisseur;
    }

    public String getIdStockClient() {
        return idStockClient;
    }

    public void setIdStockClient(String idStockClient) {
        this.idStockClient = idStockClient;
    }

    public String getIsDeleted() {
        return isDeleted;
    }

    public void setIsDeleted(String isDeleted) {
        this.isDeleted = isDeleted;
    }

    public CompteComptable getFkCompteComptable() {
        return fkCompteComptable;
    }

    public void setFkCompteComptable(CompteComptable fkCompteComptable) {
        this.fkCompteComptable = fkCompteComptable;
    }

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


    public String getNumRc() {
        return numRc;
    }

    public void setNumRc(String numRc) {
        this.numRc = numRc;
    }

    public String getCode() {
        return code;
    }

    public void setCode(String code) {
        this.code = code;
    }

    public String getDesignation() {
        return designation;
    }

    public void setDesignation(String designation) {
        this.designation = designation;
    }

    public String getAddresse() {
        return addresse;
    }

    public void setAddresse(String addresse) {
        this.addresse = addresse;
    }


    public String getNif() {
        return nif;
    }

    public void setNif(String nif) {
        this.nif = nif;
    }

    

    public String getBp() {
        return bp;
    }

    public void setBp(String bp) {
        this.bp = bp;
    }

    public String getNis() {
        return nis;
    }

    public void setNis(String nis) {
        this.nis = nis;
    }

    
    

    
}
