/**
 * City category data + zoom-level lookup.
 *
 * Direct port of Angular `CityCategoryService`. Cities are partitioned into
 * four population/resort tiers; `getCityZoomLevel` maps a city code to the
 * minimum map zoom at which its marker should render.
 *
 * Keep the Sets exported for regression tests — editing them should be an
 * intentional product decision.
 */

export const POPULATION_1KK: ReadonlySet<string> = new Set([
  "QIN", "THR", "FRU", "KZN", "LED", "IST", "HKG", "PEE", "UFA",
  "OVB", "CEK", "CAI", "SVX", "EVN", "DEL", "MSQ",
  "KJA", "KUF", "NQZ", "OMS", "ALA", "SHA", "VOG",
  "BAK", "BKK", "BJS", "MOW", "GOJ", "VVO", "KHV",
]);

export const POPULATION_500K: ReadonlySet<string> = new Set([
  "TJM", "TOF", "SKD", "ULY", "PEZ", "MCX", "KEJ",
  "IJK", "REN", "ASF", "NOZ", "BAX", "RTW", "DOH",
  "AUH", "SSH", "TAS", "CIT", "SGN", "CAN", "HRB",
  "VRA", "KGF",
]);

export const POPULATION_100K: ReadonlySet<string> = new Set([
  "MMK", "GDX", "SGC", "DYR", "ESL", "OSS", "KVD", "KVK", "GUW", "SCW",
  "SCO", "NJC", "NBC", "UGC", "UUD", "YKS", "MJZ", "SKX", "STW", "KSN",
  "KGD", "HMA", "HTA", "RGK", "GRV", "ABA", "PKC", "NAL", "MQF", "MRV",
  "OSW", "ARH", "UUS", "NUX", "BHK", "PYJ", "CSY", "BQS", "DLM",
]);

export const POPULAR_RESORTS: ReadonlySet<string> = new Set([
  "AER", "AYT", "BJV", "CMB", "DPS", "DXB", "GOI",
  "HAV", "HKT", "HRG", "MLE", "NHA", "SEZ", "SYX", "IKT",
]);

export function getCityZoomLevel(code: string): number {
  if (POPULATION_1KK.has(code) || POPULAR_RESORTS.has(code)) return 2;
  if (POPULATION_500K.has(code)) return 5;
  if (POPULATION_100K.has(code)) return 6;
  return 6;
}
