/*
 * 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 = "mouvement")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "Mouvement.findAll", query = "SELECT m FROM Mouvement m"),
    @NamedQuery(name = "Mouvement.findById", query = "SELECT m FROM Mouvement m WHERE m.id = :id"),
    @NamedQuery(name = "Mouvement.findByReference", query = "SELECT m FROM Mouvement m WHERE m.reference = :reference"),
    @NamedQuery(name = "Mouvement.findByMontant", query = "SELECT m FROM Mouvement m WHERE m.montant = :montant"),
    @NamedQuery(name = "Mouvement.findByDate", query = "SELECT m FROM Mouvement m WHERE m.date = :date"),
    @NamedQuery(name = "Mouvement.findByDesignation", query = "SELECT m FROM Mouvement m WHERE m.designation = :designation"),
    @NamedQuery(name = "Mouvement.findByBeneficier", query = "SELECT m FROM Mouvement m WHERE m.beneficier = :beneficier"),
    @NamedQuery(name = "Mouvement.findByIsDeleted", query = "SELECT m FROM Mouvement m WHERE m.isDeleted = :isDeleted"),
    @NamedQuery(name = "Mouvement.findByStockId", query = "SELECT m FROM Mouvement m WHERE m.stockId = :stockId"),
    @NamedQuery(name = "Mouvement.findByHeure", query = "SELECT m FROM Mouvement m WHERE m.heure = :heure")})
public class Mouvement implements Serializable {

    @Size(max = 50)
    @Column(name = "reference")
    private String reference;
    @Size(max = 50)
    @Column(name = "designation")
    private String designation;
    @Size(max = 50)
    @Column(name = "beneficier")
    private String beneficier;
    @Size(max = 5)
    @Column(name = "is_deleted")
    private String isDeleted;
    @Size(max = 50)
    @Column(name = "stock_id")
    private String stockId;

    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "id")
    private Integer id;
    // @Max(value=?)  @Min(value=?)//if you know range of your decimal fields consider using these annotations to enforce field validation
    @Column(name = "montant")
    private Double montant;
    @Column(name = "date")
    @Temporal(TemporalType.DATE)
    private Date date;
    @Column(name = "heure")
    @Temporal(TemporalType.TIME)
    private Date heure;
    @OneToMany(mappedBy = "fkMouvement")
    private List<Alerte> alerteList;
    @JoinColumn(name = "fk_annee_fiscale", referencedColumnName = "annee")
    @ManyToOne
    private AnneeFiscale fkAnneeFiscale;
    @JoinColumn(name = "fk_cheque", referencedColumnName = "id")
    @ManyToOne
    private Cheque fkCheque;
    @JoinColumn(name = "fk_user", referencedColumnName = "userid")
    @ManyToOne
    private ServiceUser fkUser;
    @JoinColumn(name = "fk_sort", referencedColumnName = "id")
    @ManyToOne
    private Sort fkSort;
    @JoinColumn(name = "fk_type_destinataire", referencedColumnName = "id")
    @ManyToOne
    private StockTypeDestinataire fkTypeDestinataire;
    @JoinColumn(name = "fk_tier", referencedColumnName = "id")
    @ManyToOne
    private Tier fkTier;
    @JoinColumn(name = "fk_tresorie_source", referencedColumnName = "id")
    @ManyToOne
    private Tresorie fkTresorieSource;
    @JoinColumn(name = "fk_tresorie_destinataire", referencedColumnName = "id")
    @ManyToOne
    private Tresorie fkTresorieDestinataire;
    @JoinColumn(name = "fk_type_mouvement", referencedColumnName = "id")
    @ManyToOne
    private TypeMouvement fkTypeMouvement;

    public Mouvement() {
    }

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

    public Integer getId() {
        return id;
    }

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


    public Double getMontant() {
        return montant;
    }

    public void setMontant(Double montant) {
        this.montant = montant;
    }

    public Date getDate() {
        return date;
    }

    public void setDate(Date date) {
        this.date = date;
    }


    public String getIsDeleted() {
        return isDeleted;
    }

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

    public String getStockId() {
        return stockId;
    }

    public void setStockId(String stockId) {
        this.stockId = stockId;
    }

    public Date getHeure() {
        return heure;
    }

    public void setHeure(Date heure) {
        this.heure = heure;
    }

    @XmlTransient
    public List<Alerte> getAlerteList() {
        return alerteList;
    }

    public void setAlerteList(List<Alerte> alerteList) {
        this.alerteList = alerteList;
    }

    public AnneeFiscale getFkAnneeFiscale() {
        return fkAnneeFiscale;
    }

    public void setFkAnneeFiscale(AnneeFiscale fkAnneeFiscale) {
        this.fkAnneeFiscale = fkAnneeFiscale;
    }

    public Cheque getFkCheque() {
        return fkCheque;
    }

    public void setFkCheque(Cheque fkCheque) {
        this.fkCheque = fkCheque;
    }

    public ServiceUser getFkUser() {
        return fkUser;
    }

    public void setFkUser(ServiceUser fkUser) {
        this.fkUser = fkUser;
    }

    public Sort getFkSort() {
        return fkSort;
    }

    public void setFkSort(Sort fkSort) {
        this.fkSort = fkSort;
    }

    public StockTypeDestinataire getFkTypeDestinataire() {
        return fkTypeDestinataire;
    }

    public void setFkTypeDestinataire(StockTypeDestinataire fkTypeDestinataire) {
        this.fkTypeDestinataire = fkTypeDestinataire;
    }

    public Tier getFkTier() {
        return fkTier;
    }

    public void setFkTier(Tier fkTier) {
        this.fkTier = fkTier;
    }

    public Tresorie getFkTresorieSource() {
        return fkTresorieSource;
    }

    public void setFkTresorieSource(Tresorie fkTresorieSource) {
        this.fkTresorieSource = fkTresorieSource;
    }

    public Tresorie getFkTresorieDestinataire() {
        return fkTresorieDestinataire;
    }

    public void setFkTresorieDestinataire(Tresorie fkTresorieDestinataire) {
        this.fkTresorieDestinataire = fkTresorieDestinataire;
    }

    public TypeMouvement getFkTypeMouvement() {
        return fkTypeMouvement;
    }

    public void setFkTypeMouvement(TypeMouvement fkTypeMouvement) {
        this.fkTypeMouvement = fkTypeMouvement;
    }

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

    public String getReference() {
        return reference;
    }

    public void setReference(String reference) {
        this.reference = reference;
    }

    public String getDesignation() {
        return designation;
    }

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

    public String getBeneficier() {
        return beneficier;
    }

    public void setBeneficier(String beneficier) {
        this.beneficier = beneficier;
    }

   

    
}
