/*
 * 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.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.Size;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;

/**
 *
 * @author FORCE TECH
 */
@Entity
@Table(name = "compte_comptable", catalog = "triz_tresorie", schema = "public")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "CompteComptable.findAll", query = "SELECT c FROM CompteComptable c"),
    @NamedQuery(name = "CompteComptable.findById", query = "SELECT c FROM CompteComptable c WHERE c.id = :id"),
    @NamedQuery(name = "CompteComptable.findByCode", query = "SELECT c FROM CompteComptable c WHERE c.code = :code"),
    @NamedQuery(name = "CompteComptable.findByNumCompteComptable", query = "SELECT c FROM CompteComptable c WHERE c.numCompteComptable = :numCompteComptable"),
    @NamedQuery(name = "CompteComptable.findByAccepterTier", query = "SELECT c FROM CompteComptable c WHERE c.accepterTier = :accepterTier")})
public class CompteComptable implements Serializable {

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

    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "id")
    private Integer id;
    @Column(name = "num_compte_comptable")
    private Integer numCompteComptable;
    @Column(name = "accepter_tier")
    private Boolean accepterTier;
    @OneToMany(mappedBy = "fkCompteComptable")
    private List<Tier> tierList;
    @JoinColumn(name = "fk_banque", referencedColumnName = "id")
    @ManyToOne
    private Banque fkBanque;
    @OneToMany(mappedBy = "fkCompteComptable")
    private List<Tresorie> tresorieList;

    public CompteComptable() {
    }

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

    public Integer getId() {
        return id;
    }

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


    public Integer getNumCompteComptable() {
        return numCompteComptable;
    }

    public void setNumCompteComptable(Integer numCompteComptable) {
        this.numCompteComptable = numCompteComptable;
    }

    public Boolean getAccepterTier() {
        return accepterTier;
    }

    public void setAccepterTier(Boolean accepterTier) {
        this.accepterTier = accepterTier;
    }

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

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

    public Banque getFkBanque() {
        return fkBanque;
    }

    public void setFkBanque(Banque fkBanque) {
        this.fkBanque = fkBanque;
    }

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

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

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

    public String getCode() {
        return code;
    }

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