/*
 * 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 = "chequier")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "Chequier.findAll", query = "SELECT c FROM Chequier c"),
    @NamedQuery(name = "Chequier.findById", query = "SELECT c FROM Chequier c WHERE c.id = :id"),
    @NamedQuery(name = "Chequier.findBySerie", query = "SELECT c FROM Chequier c WHERE c.serie = :serie"),
    @NamedQuery(name = "Chequier.findByRefInitiale", query = "SELECT c FROM Chequier c WHERE c.refInitiale = :refInitiale"),
    @NamedQuery(name = "Chequier.findByRefFinale", query = "SELECT c FROM Chequier c WHERE c.refFinale = :refFinale")})
public class Chequier implements Serializable {

    @Size(max = 10)
    @Column(name = "serie")
    private String serie;
    @Size(max = 10)
    @Column(name = "ref_initiale")
    private String refInitiale;
    @Size(max = 10)
    @Column(name = "ref_finale")
    private String refFinale;

    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "id")
    private Integer id;
    @JoinColumn(name = "fk_tresorie", referencedColumnName = "id")
    @ManyToOne
    private Tresorie fkTresorie;
    @OneToMany(mappedBy = "fkChequier")
    private List<Cheque> chequeList;

    public Chequier() {
    }

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

    public Integer getId() {
        return id;
    }

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


    public String getRefInitiale() {
        return refInitiale;
    }

    public void setRefInitiale(String refInitiale) {
        this.refInitiale = refInitiale;
    }

    public String getRefFinale() {
        return refFinale;
    }

    public void setRefFinale(String refFinale) {
        this.refFinale = refFinale;
    }

    public Tresorie getFkTresorie() {
        return fkTresorie;
    }

    public void setFkTresorie(Tresorie fkTresorie) {
        this.fkTresorie = fkTresorie;
    }

    @XmlTransient
    public List<Cheque> getChequeList() {
        return chequeList;
    }

    public void setChequeList(List<Cheque> chequeList) {
        this.chequeList = chequeList;
    }

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

    public String getSerie() {
        return serie;
    }

    public void setSerie(String serie) {
        this.serie = serie;
    }

    
    
}
