import { Injectable } from '@angular/core';
import {HttpClient} from "@angular/common/http";
import {Observable} from "rxjs";
import {map} from "rxjs/operators";

@Injectable({
  providedIn: 'root'
})
export class SpecialMealProviderService {

  constructor(private httpClient: HttpClient) { }

  HasSpecialMeal (model: MealApiRequestModel): Observable<boolean>{
      return this.httpClient.post<any>('/api/meal/checkspecial', model)
        .pipe(
            map(response => {
              return response;
            })
        );
  }
}
export enum SpecialMealCabinType{
  none = 0,
  econom = 1,
  comfort = 2,
  business = 4
}

export class MealApiRequestModel {
  airline: string;
  cabin: SpecialMealCabinType;
  flightDateTime: Date;
  number: string;
  origin: string;
  destination: string;
}