import { formatDate } from '@angular/common';
import { DropZoneResp } from './dropzone';
import { JumpTypeResp } from './jumpType';

export class TunnelFlightReq {
  constructor(data: any) {
    Object.assign(this, data);
  }

  public id: number;
  public tunnelId: number;
  public jumpTypeId: number;
  public nbMinutes: number;
  public notes: string;
  public flightDate: string;
}

export class TunnelFlightResp {
  constructor(data: any) {
    Object.assign(this, data);
    this.flightDate = new Date(data.flightDate);
  }

  public id: number;
  public tunnelId: number;
  public jumpTypeId: number;
  public nbMinutes: number;
  public notes: string;
  public flightDate: Date;
}

export class TunnelFlight {
  constructor(data: any) {
    Object.assign(this, data);
    this.flightDate = new Date(data.flightDate);
    this.flightMonth = formatDate(this.flightDate, "yy-MM", "en")
  }

  public id: number;
  public tunnel: DropZoneResp;
  public jumpType: JumpTypeResp;
  public nbMinutes: number;
  public notes: string;
  public flightDate: Date;
  public flightMonth: string;
}

export class TunnelFlightByMonth {
  constructor(data: any) {
    this.month = data.label;
    this.type = data.label2;
    this.nb = data.nb;
  }

  public month: string;
  public type: string;
  public nb: number;
}

export class TunnelFlightByMonthResp {
  constructor(data: any) {
    Object.assign(this, data);
  }

  public label: string;
  public label2: string;
  public nb: number;
}