import type { MonitoredAirport } from '@/types';

export const MONITORED_AIRPORTS: MonitoredAirport[] = [
  // Americas - Major US Hubs
  { iata: 'JFK', icao: 'KJFK', name: 'John F. Kennedy International', city: 'New York', country: 'USA', lat: 40.6413, lon: -73.7781, region: 'americas' },
  { iata: 'LAX', icao: 'KLAX', name: 'Los Angeles International', city: 'Los Angeles', country: 'USA', lat: 33.9416, lon: -118.4085, region: 'americas' },
  { iata: 'ORD', icao: 'KORD', name: "O'Hare International", city: 'Chicago', country: 'USA', lat: 41.9742, lon: -87.9073, region: 'americas' },
  { iata: 'ATL', icao: 'KATL', name: 'Hartsfield-Jackson Atlanta', city: 'Atlanta', country: 'USA', lat: 33.6407, lon: -84.4277, region: 'americas' },
  { iata: 'DFW', icao: 'KDFW', name: 'Dallas/Fort Worth International', city: 'Dallas', country: 'USA', lat: 32.8998, lon: -97.0403, region: 'americas' },
  { iata: 'DEN', icao: 'KDEN', name: 'Denver International', city: 'Denver', country: 'USA', lat: 39.8561, lon: -104.6737, region: 'americas' },
  { iata: 'SFO', icao: 'KSFO', name: 'San Francisco International', city: 'San Francisco', country: 'USA', lat: 37.6213, lon: -122.3790, region: 'americas' },
  { iata: 'SEA', icao: 'KSEA', name: 'Seattle-Tacoma International', city: 'Seattle', country: 'USA', lat: 47.4502, lon: -122.3088, region: 'americas' },
  { iata: 'MIA', icao: 'KMIA', name: 'Miami International', city: 'Miami', country: 'USA', lat: 25.7959, lon: -80.2870, region: 'americas' },
  { iata: 'BOS', icao: 'KBOS', name: 'Boston Logan International', city: 'Boston', country: 'USA', lat: 42.3656, lon: -71.0096, region: 'americas' },
  { iata: 'EWR', icao: 'KEWR', name: 'Newark Liberty International', city: 'Newark', country: 'USA', lat: 40.6895, lon: -74.1745, region: 'americas' },
  { iata: 'IAH', icao: 'KIAH', name: 'George Bush Intercontinental', city: 'Houston', country: 'USA', lat: 29.9902, lon: -95.3368, region: 'americas' },
  { iata: 'PHX', icao: 'KPHX', name: 'Phoenix Sky Harbor', city: 'Phoenix', country: 'USA', lat: 33.4373, lon: -112.0078, region: 'americas' },
  { iata: 'LAS', icao: 'KLAS', name: 'Harry Reid International', city: 'Las Vegas', country: 'USA', lat: 36.0840, lon: -115.1537, region: 'americas' },
  // Americas - Other
  { iata: 'YYZ', icao: 'CYYZ', name: 'Toronto Pearson', city: 'Toronto', country: 'Canada', lat: 43.6777, lon: -79.6248, region: 'americas' },
  { iata: 'YVR', icao: 'CYVR', name: 'Vancouver International', city: 'Vancouver', country: 'Canada', lat: 49.1947, lon: -123.1792, region: 'americas' },
  { iata: 'MEX', icao: 'MMMX', name: 'Mexico City International', city: 'Mexico City', country: 'Mexico', lat: 19.4363, lon: -99.0721, region: 'americas' },
  { iata: 'GRU', icao: 'SBGR', name: 'São Paulo–Guarulhos', city: 'São Paulo', country: 'Brazil', lat: -23.4356, lon: -46.4731, region: 'americas' },
  { iata: 'EZE', icao: 'SAEZ', name: 'Ministro Pistarini', city: 'Buenos Aires', country: 'Argentina', lat: -34.8222, lon: -58.5358, region: 'americas' },
  { iata: 'BOG', icao: 'SKBO', name: 'El Dorado International', city: 'Bogotá', country: 'Colombia', lat: 4.7016, lon: -74.1469, region: 'americas' },
  { iata: 'SCL', icao: 'SCEL', name: 'Arturo Merino Benítez', city: 'Santiago', country: 'Chile', lat: -33.3930, lon: -70.7858, region: 'americas' },
  { iata: 'LIM', icao: 'SPJC', name: 'Jorge Chávez International', city: 'Lima', country: 'Peru', lat: -12.0219, lon: -77.1143, region: 'americas' },

  // Europe - Major Hubs
  { iata: 'LHR', icao: 'EGLL', name: 'London Heathrow', city: 'London', country: 'UK', lat: 51.4700, lon: -0.4543, region: 'europe' },
  { iata: 'CDG', icao: 'LFPG', name: 'Paris Charles de Gaulle', city: 'Paris', country: 'France', lat: 49.0097, lon: 2.5479, region: 'europe' },
  { iata: 'FRA', icao: 'EDDF', name: 'Frankfurt Airport', city: 'Frankfurt', country: 'Germany', lat: 50.0379, lon: 8.5622, region: 'europe' },
  { iata: 'AMS', icao: 'EHAM', name: 'Amsterdam Schiphol', city: 'Amsterdam', country: 'Netherlands', lat: 52.3105, lon: 4.7683, region: 'europe' },
  { iata: 'MAD', icao: 'LEMD', name: 'Adolfo Suárez Madrid–Barajas', city: 'Madrid', country: 'Spain', lat: 40.4983, lon: -3.5676, region: 'europe' },
  { iata: 'FCO', icao: 'LIRF', name: 'Leonardo da Vinci–Fiumicino', city: 'Rome', country: 'Italy', lat: 41.8003, lon: 12.2389, region: 'europe' },
  { iata: 'MUC', icao: 'EDDM', name: 'Munich Airport', city: 'Munich', country: 'Germany', lat: 48.3537, lon: 11.7750, region: 'europe' },
  { iata: 'BCN', icao: 'LEBL', name: 'Barcelona–El Prat', city: 'Barcelona', country: 'Spain', lat: 41.2974, lon: 2.0833, region: 'europe' },
  { iata: 'LGW', icao: 'EGKK', name: 'London Gatwick', city: 'London', country: 'UK', lat: 51.1537, lon: -0.1821, region: 'europe' },
  { iata: 'ZRH', icao: 'LSZH', name: 'Zurich Airport', city: 'Zurich', country: 'Switzerland', lat: 47.4647, lon: 8.5492, region: 'europe' },
  { iata: 'VIE', icao: 'LOWW', name: 'Vienna International', city: 'Vienna', country: 'Austria', lat: 48.1103, lon: 16.5697, region: 'europe' },
  { iata: 'CPH', icao: 'EKCH', name: 'Copenhagen Airport', city: 'Copenhagen', country: 'Denmark', lat: 55.6180, lon: 12.6508, region: 'europe' },
  { iata: 'DUB', icao: 'EIDW', name: 'Dublin Airport', city: 'Dublin', country: 'Ireland', lat: 53.4264, lon: -6.2499, region: 'europe' },
  { iata: 'IST', icao: 'LTFM', name: 'Istanbul Airport', city: 'Istanbul', country: 'Turkey', lat: 41.2753, lon: 28.7519, region: 'europe' },
  { iata: 'LIS', icao: 'LPPT', name: 'Humberto Delgado Airport', city: 'Lisbon', country: 'Portugal', lat: 38.7756, lon: -9.1354, region: 'europe' },
  { iata: 'ATH', icao: 'LGAV', name: 'Athens International', city: 'Athens', country: 'Greece', lat: 37.9364, lon: 23.9445, region: 'europe' },
  { iata: 'WAW', icao: 'EPWA', name: 'Warsaw Chopin Airport', city: 'Warsaw', country: 'Poland', lat: 52.1657, lon: 20.9671, region: 'europe' },
  { iata: 'SVO', icao: 'UUEE', name: 'Sheremetyevo International', city: 'Moscow', country: 'Russia', lat: 55.9736, lon: 37.4125, region: 'europe' },
  { iata: 'ARN', icao: 'ESSA', name: 'Stockholm Arlanda', city: 'Stockholm', country: 'Sweden', lat: 59.6519, lon: 17.9186, region: 'europe' },
  { iata: 'OSL', icao: 'ENGM', name: 'Oslo Gardermoen', city: 'Oslo', country: 'Norway', lat: 60.1939, lon: 11.1004, region: 'europe' },
  { iata: 'HEL', icao: 'EFHK', name: 'Helsinki-Vantaa', city: 'Helsinki', country: 'Finland', lat: 60.3172, lon: 24.9633, region: 'europe' },

  // Asia-Pacific
  { iata: 'HND', icao: 'RJTT', name: 'Tokyo Haneda', city: 'Tokyo', country: 'Japan', lat: 35.5494, lon: 139.7798, region: 'apac' },
  { iata: 'NRT', icao: 'RJAA', name: 'Narita International', city: 'Tokyo', country: 'Japan', lat: 35.7720, lon: 140.3929, region: 'apac' },
  { iata: 'PEK', icao: 'ZBAA', name: 'Beijing Capital', city: 'Beijing', country: 'China', lat: 40.0799, lon: 116.6031, region: 'apac' },
  { iata: 'PVG', icao: 'ZSPD', name: 'Shanghai Pudong', city: 'Shanghai', country: 'China', lat: 31.1443, lon: 121.8083, region: 'apac' },
  { iata: 'CAN', icao: 'ZGGG', name: 'Guangzhou Baiyun International', city: 'Guangzhou', country: 'China', lat: 23.3924, lon: 113.2988, region: 'apac' },
  { iata: 'HKG', icao: 'VHHH', name: 'Hong Kong International', city: 'Hong Kong', country: 'China', lat: 22.3080, lon: 113.9185, region: 'apac' },
  { iata: 'SIN', icao: 'WSSS', name: 'Singapore Changi', city: 'Singapore', country: 'Singapore', lat: 1.3644, lon: 103.9915, region: 'apac' },
  { iata: 'ICN', icao: 'RKSI', name: 'Incheon International', city: 'Seoul', country: 'South Korea', lat: 37.4602, lon: 126.4407, region: 'apac' },
  { iata: 'BKK', icao: 'VTBS', name: 'Suvarnabhumi Airport', city: 'Bangkok', country: 'Thailand', lat: 13.6900, lon: 100.7501, region: 'apac' },
  { iata: 'SYD', icao: 'YSSY', name: 'Sydney Kingsford Smith', city: 'Sydney', country: 'Australia', lat: -33.9461, lon: 151.1772, region: 'apac' },
  { iata: 'MEL', icao: 'YMML', name: 'Melbourne Airport', city: 'Melbourne', country: 'Australia', lat: -37.6690, lon: 144.8410, region: 'apac' },
  { iata: 'DEL', icao: 'VIDP', name: 'Indira Gandhi International', city: 'Delhi', country: 'India', lat: 28.5562, lon: 77.1000, region: 'apac' },
  { iata: 'BOM', icao: 'VABB', name: 'Chhatrapati Shivaji Maharaj', city: 'Mumbai', country: 'India', lat: 19.0896, lon: 72.8656, region: 'apac' },
  { iata: 'KUL', icao: 'WMKK', name: 'Kuala Lumpur International', city: 'Kuala Lumpur', country: 'Malaysia', lat: 2.7456, lon: 101.7099, region: 'apac' },
  { iata: 'CGK', icao: 'WIII', name: 'Soekarno-Hatta International', city: 'Jakarta', country: 'Indonesia', lat: -6.1256, lon: 106.6558, region: 'apac' },
  { iata: 'MNL', icao: 'RPLL', name: 'Ninoy Aquino International', city: 'Manila', country: 'Philippines', lat: 14.5086, lon: 121.0197, region: 'apac' },
  { iata: 'TPE', icao: 'RCTP', name: 'Taiwan Taoyuan International', city: 'Taipei', country: 'Taiwan', lat: 25.0797, lon: 121.2342, region: 'apac' },
  { iata: 'AKL', icao: 'NZAA', name: 'Auckland Airport', city: 'Auckland', country: 'New Zealand', lat: -37.0082, lon: 174.7850, region: 'apac' },
  // Pakistan
  { iata: 'KHI', icao: 'OPKC', name: 'Jinnah International', city: 'Karachi', country: 'Pakistan', lat: 24.9065, lon: 67.1610, region: 'apac' },
  { iata: 'ISB', icao: 'OPIS', name: 'Islamabad International', city: 'Islamabad', country: 'Pakistan', lat: 33.5605, lon: 72.8526, region: 'apac' },
  { iata: 'LHE', icao: 'OPLA', name: 'Allama Iqbal International', city: 'Lahore', country: 'Pakistan', lat: 31.5216, lon: 74.4036, region: 'apac' },

  // Middle East & North Africa
  { iata: 'DXB', icao: 'OMDB', name: 'Dubai International', city: 'Dubai', country: 'UAE', lat: 25.2532, lon: 55.3657, region: 'mena' },
  { iata: 'DOH', icao: 'OTHH', name: 'Hamad International', city: 'Doha', country: 'Qatar', lat: 25.2731, lon: 51.6081, region: 'mena' },
  { iata: 'AUH', icao: 'OMAA', name: 'Abu Dhabi International', city: 'Abu Dhabi', country: 'UAE', lat: 24.4330, lon: 54.6511, region: 'mena' },
  { iata: 'RUH', icao: 'OERK', name: 'King Khalid International', city: 'Riyadh', country: 'Saudi Arabia', lat: 24.9576, lon: 46.6988, region: 'mena' },
  { iata: 'JED', icao: 'OEJN', name: 'King Abdulaziz International', city: 'Jeddah', country: 'Saudi Arabia', lat: 21.6796, lon: 39.1565, region: 'mena' },
  { iata: 'CAI', icao: 'HECA', name: 'Cairo International', city: 'Cairo', country: 'Egypt', lat: 30.1219, lon: 31.4056, region: 'mena' },
  { iata: 'TLV', icao: 'LLBG', name: 'Ben Gurion Airport', city: 'Tel Aviv', country: 'Israel', lat: 32.0055, lon: 34.8854, region: 'mena' },
  { iata: 'AMM', icao: 'OJAI', name: 'Queen Alia International', city: 'Amman', country: 'Jordan', lat: 31.7226, lon: 35.9932, region: 'mena' },
  { iata: 'BAH', icao: 'OBBI', name: 'Bahrain International', city: 'Manama', country: 'Bahrain', lat: 26.2708, lon: 50.6336, region: 'mena' },
  { iata: 'KWI', icao: 'OKBK', name: 'Kuwait International', city: 'Kuwait City', country: 'Kuwait', lat: 29.2266, lon: 47.9689, region: 'mena' },
  { iata: 'MCT', icao: 'OOMS', name: 'Muscat International', city: 'Muscat', country: 'Oman', lat: 23.5933, lon: 58.2844, region: 'mena' },
  { iata: 'CMN', icao: 'GMMN', name: 'Mohammed V International', city: 'Casablanca', country: 'Morocco', lat: 33.3675, lon: -7.5898, region: 'mena' },
  { iata: 'ALG', icao: 'DAAG', name: 'Houari Boumediene Airport', city: 'Algiers', country: 'Algeria', lat: 36.6910, lon: 3.2154, region: 'mena' },
  { iata: 'TUN', icao: 'DTTA', name: 'Tunis–Carthage International', city: 'Tunis', country: 'Tunisia', lat: 36.8510, lon: 10.2272, region: 'mena' },
  // Iran
  { iata: 'IKA', icao: 'OIIE', name: 'Imam Khomeini International', city: 'Tehran', country: 'Iran', lat: 35.4161, lon: 51.1522, region: 'mena' },
  { iata: 'THR', icao: 'OIII', name: 'Mehrabad International', city: 'Tehran', country: 'Iran', lat: 35.6892, lon: 51.3134, region: 'mena' },
  { iata: 'MHD', icao: 'OIMM', name: 'Shahid Hashemi Nejad', city: 'Mashhad', country: 'Iran', lat: 36.2352, lon: 59.6410, region: 'mena' },
  { iata: 'SYZ', icao: 'OISS', name: 'Shiraz International', city: 'Shiraz', country: 'Iran', lat: 29.5392, lon: 52.5899, region: 'mena' },
  { iata: 'IFN', icao: 'OIFM', name: 'Isfahan International', city: 'Isfahan', country: 'Iran', lat: 32.7508, lon: 51.8613, region: 'mena' },
  // Iraq
  { iata: 'BGW', icao: 'ORBI', name: 'Baghdad International', city: 'Baghdad', country: 'Iraq', lat: 33.2625, lon: 44.2346, region: 'mena' },
  { iata: 'BSR', icao: 'ORMM', name: 'Basra International', city: 'Basra', country: 'Iraq', lat: 30.5491, lon: 47.6622, region: 'mena' },
  { iata: 'EBL', icao: 'ORER', name: 'Erbil International', city: 'Erbil', country: 'Iraq', lat: 36.2376, lon: 43.9632, region: 'mena' },
  { iata: 'NJF', icao: 'ORNI', name: 'Al Najaf International', city: 'Najaf', country: 'Iraq', lat: 31.9900, lon: 44.4040, region: 'mena' },
  // Lebanon / Syria / Yemen
  { iata: 'BEY', icao: 'OLBA', name: 'Rafic Hariri International', city: 'Beirut', country: 'Lebanon', lat: 33.8209, lon: 35.4884, region: 'mena' },
  { iata: 'DAM', icao: 'OSDI', name: 'Damascus International', city: 'Damascus', country: 'Syria', lat: 33.4115, lon: 36.5156, region: 'mena' },
  { iata: 'ALP', icao: 'OSAP', name: 'Aleppo International', city: 'Aleppo', country: 'Syria', lat: 36.1807, lon: 37.2244, region: 'mena' },
  { iata: 'SAH', icao: 'OYSN', name: "Sana'a International", city: "Sana'a", country: 'Yemen', lat: 15.4763, lon: 44.2197, region: 'mena' },
  { iata: 'ADE', icao: 'OYAA', name: 'Aden International', city: 'Aden', country: 'Yemen', lat: 12.8295, lon: 45.0288, region: 'mena' },
  // UAE / Saudi extras
  { iata: 'SHJ', icao: 'OMSJ', name: 'Sharjah International', city: 'Sharjah', country: 'UAE', lat: 25.3286, lon: 55.5172, region: 'mena' },
  { iata: 'DWC', icao: 'OMDW', name: 'Al Maktoum International', city: 'Dubai', country: 'UAE', lat: 24.8960, lon: 55.1614, region: 'mena' },
  { iata: 'DMM', icao: 'OEDF', name: 'King Fahd International', city: 'Dammam', country: 'Saudi Arabia', lat: 26.4712, lon: 49.7979, region: 'mena' },
  { iata: 'MED', icao: 'OEMA', name: 'Prince Mohammad bin Abdulaziz', city: 'Medina', country: 'Saudi Arabia', lat: 24.5534, lon: 39.7051, region: 'mena' },
  // Turkey extras
  { iata: 'SAW', icao: 'LTFJ', name: 'Sabiha Gökçen International', city: 'Istanbul', country: 'Turkey', lat: 40.8986, lon: 29.3092, region: 'mena' },
  { iata: 'ESB', icao: 'LTAC', name: 'Esenboğa International', city: 'Ankara', country: 'Turkey', lat: 40.1281, lon: 32.9951, region: 'mena' },
  { iata: 'ADB', icao: 'LTBJ', name: 'Adnan Menderes Airport', city: 'Izmir', country: 'Turkey', lat: 38.2924, lon: 27.1570, region: 'mena' },
  { iata: 'AYT', icao: 'LTAI', name: 'Antalya Airport', city: 'Antalya', country: 'Turkey', lat: 36.8987, lon: 30.8005, region: 'mena' },

  // Africa
  { iata: 'JNB', icao: 'FAOR', name: 'O.R. Tambo International', city: 'Johannesburg', country: 'South Africa', lat: -26.1392, lon: 28.2460, region: 'africa' },
  { iata: 'CPT', icao: 'FACT', name: 'Cape Town International', city: 'Cape Town', country: 'South Africa', lat: -33.9715, lon: 18.6021, region: 'africa' },
  { iata: 'NBO', icao: 'HKJK', name: 'Jomo Kenyatta International', city: 'Nairobi', country: 'Kenya', lat: -1.3192, lon: 36.9278, region: 'africa' },
  { iata: 'LOS', icao: 'DNMM', name: 'Murtala Muhammed International', city: 'Lagos', country: 'Nigeria', lat: 6.5774, lon: 3.3212, region: 'africa' },
  { iata: 'ADD', icao: 'HAAB', name: 'Bole International', city: 'Addis Ababa', country: 'Ethiopia', lat: 8.9779, lon: 38.7993, region: 'africa' },
  { iata: 'ACC', icao: 'DGAA', name: 'Kotoka International', city: 'Accra', country: 'Ghana', lat: 5.6052, lon: -0.1668, region: 'africa' },
  { iata: 'DAR', icao: 'HTDA', name: 'Julius Nyerere International', city: 'Dar es Salaam', country: 'Tanzania', lat: -6.8781, lon: 39.2026, region: 'africa' },
  { iata: 'MRU', icao: 'FIMP', name: 'Sir Seewoosagur Ramgoolam', city: 'Mauritius', country: 'Mauritius', lat: -20.4302, lon: 57.6836, region: 'africa' },
  // Libya / Sudan
  { iata: 'TIP', icao: 'HLLT', name: 'Mitiga International', city: 'Tripoli', country: 'Libya', lat: 32.8951, lon: 13.2760, region: 'africa' },
  { iata: 'BEN', icao: 'HLLB', name: 'Benina International', city: 'Benghazi', country: 'Libya', lat: 32.0968, lon: 20.2695, region: 'africa' },
  { iata: 'KRT', icao: 'HSSS', name: 'Khartoum International', city: 'Khartoum', country: 'Sudan', lat: 15.5895, lon: 32.5532, region: 'africa' },
];

// FAA-monitored airports (subset that works with FAA ASWS API)
export const FAA_AIRPORTS = MONITORED_AIRPORTS.filter(
  (a) => a.country === 'USA'
).map((a) => a.iata);

// Top international hubs queried via AviationStack (non-US; US uses FAA)
// All airports remain in MONITORED_AIRPORTS for map display, NOTAMs, and gray dots
export const AVIATIONSTACK_AIRPORTS: string[] = [
  // Americas (7)
  'YYZ', 'YVR', 'MEX', 'GRU', 'EZE', 'BOG', 'SCL',
  // Europe (16)
  'LHR', 'CDG', 'FRA', 'AMS', 'MAD', 'FCO', 'MUC', 'BCN', 'ZRH', 'IST', 'VIE', 'CPH',
  'DUB', 'LIS', 'ATH', 'WAW',
  // APAC (15)
  'HND', 'NRT', 'PEK', 'PVG', 'HKG', 'SIN', 'ICN', 'BKK', 'SYD', 'DEL', 'BOM', 'KUL',
  'CAN', 'TPE', 'MNL',
  // MENA (9)
  'DXB', 'DOH', 'AUH', 'RUH', 'CAI', 'TLV', 'AMM', 'KWI', 'CMN',
  // Africa (5)
  'JNB', 'NBO', 'LOS', 'ADD', 'CPT',
];

// Severity thresholds
export const DELAY_SEVERITY_THRESHOLDS = {
  minor: { avgDelayMinutes: 15, delayedPct: 15 },
  moderate: { avgDelayMinutes: 30, delayedPct: 30 },
  major: { avgDelayMinutes: 45, delayedPct: 45 },
  severe: { avgDelayMinutes: 60, delayedPct: 60 },
};
