export interface SkyCondition {
  sky_cover: string;
  cloud_base_ft_agl: number;
}

export interface PeakWind {
  degrees: number;
  speed: number;
  hour?: number;
  minute?: number;
}

export interface Remarks {
  peak_wind?: PeakWind;
  auto_station_type?: string;
  maintenance_indicator_on?: boolean;
  rvr_missing?: boolean;
  precipitation_identifier_information_not_available?: boolean;
  precipitation_information_not_available?: boolean;
  freezing_rain_information_not_available?: boolean;
  thunderstorm_information_not_available?: boolean;
  visibility_at_secondary_location_not_available?: boolean;
  sky_condition_at_secondary_location_not_available?: boolean;
}

export interface RunwayVisualRange {
  runway: string;
  visibility_ft: string;
  variable_visibility_high_ft: string;
  variable_visibility_low_ft: string;
}

export interface Metar {
  icao: string;
  raw_text: string;
  observation_time: string;
  flight_category: 'VFR' | 'MVFR' | 'LIFR' | 'IFR' | 'UNKN';
  report_modifier?: string;
  becoming_change?: boolean;
  no_significant_change?: boolean;
  temporary_change?: boolean;
  temp_c?: number;
  dew_point_c?: number;
  estimated_humidity?: number;
  wind_dir_degrees?: string;
  wind_speed_kt?: number;
  wind_gust_kt?: number;
  variable_wind_dir_degrees?: string;
  visibility_statute_mi?: string;
  runway_visual_range: RunwayVisualRange[];
  altimeter_in_hg?: number;
  sea_level_pressure_mb?: number;
  remarks: Remarks;
  weather_phenomena: string[];
  sky_condition: SkyCondition[];
  max_temp_c?: number;
  min_temp_c?: number;
  density_altutude?: number;
}

export function getMarkerColor(flightCategory: 'VFR' | 'MVFR' | 'LIFR' | 'IFR' | 'UNKN'): string {
  switch (flightCategory) {
    case 'IFR':
      return '#ff0100';
    case 'LIFR':
      return '#7f007f';
    case 'MVFR':
      return '#00f';
    case 'VFR':
      return '#018000';
    case 'UNKN':
      return '#696969';
  }
}
