package Models.Client;

import java.time.LocalDate;
import java.util.Date;

/**
 * @author Maher Ben Tili
 */
public class Client {
    
    public String codeclient ;
    public int cin ;
    public String nomcomplet;
    public String nom ;
    public String prenom ;
    public String DateNaissanceString ;
    public Date naissance ;
    public Long telefix ;
    public Long telemobile ;
    public String adresse ;
    public String codepostal ;
    public String mail ;
    public int sexe ;

    public String getCodeclient() {
        return codeclient;
    }

    public void setCodeclient(String codeclient) {
        this.codeclient = codeclient;
    }

   public String getCinString() {
        return String.valueOf(cin);
    }
   
    public int getCin() {
        return cin ;
    }

    public void setCin(int cin) {
        this.cin = cin;
    }
    public void setCinString(String cin) {
        this.cin = Integer.parseInt(cin);
    }
    
    public String getNomcomplet() {
        return nomcomplet;
    }

    public void setNomcomplet(String nomcomplet) {
        this.nomcomplet = nomcomplet;
    }

    public String getNom() {
        return nom;
    }

    public void setNom(String nom) {
        this.nom = nom;
    }

    public String getPrenom() {
        return prenom;
    }

    public void setPrenom(String prenom) {
        this.prenom = prenom;
    }

    public Date getNaissance() {
        return naissance;
    }

    public void setNaissance(Date naissance) {
        this.naissance = naissance;
    }
    
    public void setNaissanceDatePicker(LocalDate naissance) {
        this.naissance = java.sql.Date.valueOf(naissance);
    }

    public String getDateNaissanceString() {
        return DateNaissanceString;
    }

    public void setDateNaissanceString(String DateNaissanceString) {
        this.DateNaissanceString = DateNaissanceString;
    }
    
    
    
    public Long getTelefix() {
        if(telefix != null){
            return telefix;
        }
        else{
            return null ;
        }
    }
    public String getTelefixString() {
        if(telefix != null){
            return telefix.toString();
        }
        else{
            return null ;
        }
    }
    
    public void setTelefix(Long telefix) {
        this.telefix = telefix;
    }
    public void setTelefixString(String telefix) {
        if(telefix!=null){
            this.telefix = Long.parseLong(telefix);
        }
    }

    public Long getTelemobile() {
        return telemobile;
    }
    
    public String getTelemobileString() {
        if(telemobile != null){
            return telemobile.toString();
        }
        else{
            return null ;
        }
       
    }
    
    
    

    public void setTelemobile(Long telemobile) {
        this.telemobile = telemobile;
    }
    public void setTelemobileString(String telemobile) {
        if(telemobile != null){
            if(!telemobile.isEmpty()){
                this.telemobile = Long.parseLong(telemobile);
            }
        }
    }
    
    public String getAdresse() {
        return adresse;
    }

    public void setAdresse(String adresse) {
        this.adresse = adresse;
    }

    public String getCodepostal() {
        return codepostal;
    }

    public void setCodepostal(String codepostal) {
        this.codepostal = codepostal;
    }
    
    
    
    
    public String getMail() {
        return mail;
    }

    public void setMail(String mail) {
        this.mail = mail;
    }

    public int getSexe() {
        return sexe;
    }

    public void setSexe(int sexe) {
        this.sexe = sexe;
    }
    
    public String getSexeString() {
        if(this.sexe== 1){
            return "Homme";
        }
        else{
            return "Femme";
        }
    }
    
     public void setSexeString(String sexe) {
        if(sexe.equals("Homme")){
            this.sexe=1;
        }
        else{
            this.sexe=0;
        }
        
    }

    @Override
    public String toString() {
        return "Client{" + "codeclient=" + codeclient + ", cin=" + cin + ", nomcomplet=" + nomcomplet + ", nom=" + nom + ", prenom=" + prenom + ", naissance=" + naissance + ", telefix=" + telefix + ", telemobile=" + telemobile + ", adresse=" + adresse + ", codepostal=" + codepostal + ", mail=" + mail + ", sexe=" + sexe + '}';
    }

    
    
     
     
     
}
