package Models.Produit;

/**
 *
 * @author Maher Ben Tili
 */
public class Produit {
    private String reference;
    private String codebarre ;
    private String designation; 
    private String categorie; 
    private String marque; 
    private String couleur;
    private String description;
    private Integer garantie ;
    
    private String quantite;
    
    private String prixachatht ;
    private String tvaachat;
    private String prixachatttc ;
    
    private String marge ;
    
    private String  prixventeht;
    private String  tvavente ;
    private String  prixventettc ;
    
    private String  poids ;
    private String  dimensions;
    private String  vitesse;       
    private String  puissance;
    private String  capacite;
    
    public Produit(){
        
    }
    
    public Produit(String reference, String codebarre, String designation, String marque, String categorie, String quantite, String prix_vente_ht, String prix_vente_ttc, String tva_vente, String marge, String prix_achat_ht, String prix_achat_ttc, String tva_achat) 
    {
        this.reference = reference;
        this.codebarre = codebarre;
        
        this.designation = designation; 
        this.categorie = categorie; 
        this.marque = marque;
        
        this.quantite = quantite;
        
        this.prixachatht = prix_achat_ht;
        this.tvaachat = tva_achat;
        this.prixachatttc = prix_achat_ttc;

        this.marge = marge;

        this.prixventeht = prix_vente_ht;
        this.tvavente = tva_vente;
        this.prixventettc = prix_vente_ttc;
    }
    
    public String getReference() {
        return reference;
    }

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

    public String getCodebarre() {
        return codebarre;
    }

    public void setCodebarre(String codebarre) {
        this.codebarre = codebarre;
    }

    
    public String getDesignation() {
        return designation;
    }

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

    public String getPrixachatht() {
        return prixachatht;
    }
    
    
    public void setPrixachatht(String prixachatht) {
        this.prixachatht = prixachatht;
    }

    public String getTvaachat() {
        return tvaachat;
    }
    
    
    public void setTvaachat(String tvaachat) {
        this.tvaachat = tvaachat;
    }

    public String getPrixventeht() {
        return prixventeht;
    }
    
    
    public void setPrixventeht(String prixventeht) {
        this.prixventeht = prixventeht;
    }

    public String getTvavente() {
        return tvavente;
    }
    
    
    public void setTvavente(String tvavente) {
        this.tvavente = tvavente;
    }

    public String getQuantite() {
        return quantite;
    }

    public void setQuantite(String quantite) {
        this.quantite = quantite;
    }

    
    
    
    public String getCategorie() {
        return categorie;
    }

    public void setCategorie(String categorie) {
        this.categorie = categorie;
    }

    public String getMarque() {
        return marque;
    }

    public void setMarque(String marque) {
        this.marque = marque;
    }

    public String getCouleur() {
        return couleur;
    }

    public String getPrixachatttc() {
        return prixachatttc;
    }

    
    
    public String getMarge() {
        return marge;
    }
    
    
    
    public void setMarge(String marge) {
        this.marge = marge;
    }
    
    
    public String getPrixventettc() {
        return prixventettc;
    }
    
    
    public String getPoids() {
        return poids;
    }

    public String getDimensions() {
        return dimensions;
    }

    public String getVitesse() {
        return vitesse;
    }

    public String getPuissance() {
        return puissance;
    }

    public String getCapacite() {
        return capacite;
    }

    public void setPrixachatttc(String prixachatttc) {
        this.prixachatttc = prixachatttc;
    }

    

    public void setPrixventettc(String prixventettc) {
        this.prixventettc = prixventettc;
    }

    public void setPoids(String poids) {
        this.poids = poids;
    }

    public void setDimensions(String dimensions) {
        this.dimensions = dimensions;
    }

    public void setVitesse(String vitesse) {
        this.vitesse = vitesse;
    }

    public void setPuissance(String puissance) {
        this.puissance = puissance;
    }

    public void setCapacite(String capacite) {
        this.capacite = capacite;
    }
    
    
    
    public void setCouleur(String couleur) {
        this.couleur = couleur;
    }

    public String getDescription() {
        return description;
    }

    public void setDescription(String description) {
         // supprimer les balises si le HTMLEditor description vide
        if(description.equals("<html dir=\"ltr\"><head></head><body contenteditable=\"true\"></body></html>")){
            this.description = "";
        }
        else{
            this.description = description;
        }
    }

    

    public Integer getGarantie() {
        return garantie;
    }

    public void setGarantie(Integer garantie) {
        this.garantie = garantie;
    }

    public void setGarantieString(String garantie) {
        if(!garantie.equals("")){
            try{
                this.garantie = Integer.parseInt(garantie);
            }catch(Exception ex){
                this.garantie =  null; 
            }
        }else{
            this.garantie =  null;    
        }
    }
}
