export class Chantier{
    id: number;
    adresse: string;
    etat: string;
    contact: string;
    chef: Chef;
    equipe : Equipier[];
    materiel : Materiel[];
    dateDep : string;
    tempsEst : number;
    vehicules : Vehicule[];
    anomalies : string[];

        constructor(
        id: number,
        adresse: string,
        etat: string,
        contact: string,
        chef: Chef,
        equipe: Equipier[],
        materiel: Materiel[],
        dateDep: string,
        tempsEst: number,
        vehicules: Vehicule[],
        anomalies: string[]
    ) {
        this.id = id;
        this.adresse = adresse;
        this.etat = etat;
        this.contact = contact;
        this.chef = chef;
        this.equipe = equipe;
        this.materiel = materiel;
        this.dateDep = dateDep;
        this.tempsEst = tempsEst;
        this.vehicules = vehicules;
        this.anomalies = anomalies;
    }
}

export abstract class Equipier{
    id: number;
    nom: string;
    prenom: string;
    allocation: Reservation[];

    constructor(id: number, nom:string, prenom:string, allocation: Reservation[]){
        this.id = id;
        this.nom = nom;
        this.prenom = prenom;
        this.allocation = allocation;
    }
}

export class Chef extends Equipier{
    constructor(id: number, nom:string, prenom:string, allocation: Reservation[]){
        super(id,nom,prenom,allocation);
    }
}

export class Ouvrier extends Equipier{
    qualification : string;

    constructor(id: number, nom:string, prenom:string, allocation: Reservation[], qualification: string){
        super(id,nom,prenom,allocation);
        this.qualification=qualification;
    }
}

export class ResponsableChantier extends Equipier{
    constructor(id: number, nom:string, prenom:string, allocation: Reservation[]){
        super(id,nom,prenom,allocation);
    } 
}

export class Materiel {
    id: number;
    nom: string;
    prenom: string;
    type: string;
    allocation: Reservation[];

    constructor(
        id: number,
        nom: string,
        prenom: string,
        type: string,
        allocation: Reservation[]
    ) {
        this.id = id;
        this.nom = nom;
        this.prenom = prenom;
        this.type = type;
        this.allocation = allocation;
    }
}


export class Reservation {
    id: string;
    dateChantier: Date;
    dateFin: Date;
    duree: number;

    constructor(
        id: string,
        dateChantier: Date,
        dateFin: Date,
        duree: number
    ) {
        this.id = id;
        this.dateChantier = dateChantier;
        this.dateFin = dateFin;
        this.duree = duree;
    }
}


export class Vehicule {
    id: number;
    nom: string;
    type: string;
    allocation: Reservation[];

    constructor(
        id: number,
        nom: string,
        type: string,
        allocation: Reservation[]
    ) {
        this.id = id;
        this.nom = nom;
        this.type = type;
        this.allocation = allocation;
    }
}


export const exempleChantier = new Chantier(1,"Rennes","en cours","contact",new Chef(1,"Chyeef","YEE",[]),[],[],"01/01/25",10,[],["YEE"])
