import { Travail } from "../models/travail";
import { TravailType } from "../utils/constant";

export class Devoir implements Travail {
  static idCounter = 1;
  id: string;
  type: TravailType;
  nom: string;
  description: string;
  dateDebut: Date;
  dateFin: Date;
  noteMax: number;
  actif: boolean;

  constructor(
    nom: string,
    description: string,
    dateDebut: Date,
    dateFin: Date,
    noteMax: number,
    actif: boolean,
    id: string = `D${Devoir.idCounter < 10 ? "0" : ""}${Devoir.idCounter++}`
  ) {
    this.id = id;
    this.type = "DEVOIR";
    this.nom = nom;
    this.description = description;
    this.dateDebut = dateDebut;
    this.dateFin = dateFin;
    this.noteMax = noteMax;
    this.actif = actif;
  }

  public edit(description, date_debut, date_fin, note_max, actif) {
    this.description = description;
    this.dateDebut = date_debut;
    this.dateFin = date_fin;
    this.noteMax = note_max;
    this.actif = actif;
  }
}
