// Approximate UTC offset (hours) per country code — same per-country
// precision the old places.json dataset provided (it stored one
// timezone per country too, not per city), just as a small hand-kept
// table instead of extracting it from a ~36MB JSON file. Multi-timezone
// countries (US, RU, AU, ...) are necessarily imprecise here; a real
// per-place value would need the Google Time Zone API enabled.
export const COUNTRY_UTC_OFFSETS: Record<string, number> = {
  IN: 5.5, US: -5, GB: 0, CA: -5, AU: 10, DE: 1, FR: 1, IT: 1, ES: 1, NL: 1,
  BR: -3, RU: 3, CN: 8, JP: 9, KR: 9, SG: 8, AE: 4, SA: 3, PK: 5, BD: 6,
  NP: 5.75, LK: 5.5, ID: 7, MY: 8, TH: 7, VN: 7, PH: 8, ZA: 2, NG: 1, EG: 2,
  MX: -6, AR: -3, CL: -4, CO: -5, PE: -5, TR: 3, IR: 3.5, IQ: 3, IL: 2,
  SE: 1, NO: 1, DK: 1, FI: 2, PL: 1, PT: 0, IE: 0, CH: 1, AT: 1, BE: 1,
  GR: 2, CZ: 1, HU: 1, RO: 2, UA: 2, KZ: 6, UZ: 5, AF: 4.5, MM: 6.5,
  KH: 7, LA: 7, MN: 8, TW: 8, HK: 8, NZ: 12, FJ: 12, KE: 3, TZ: 3,
  ET: 3, GH: 0, MA: 1, DZ: 1, TN: 1, LY: 2, JO: 3, LB: 2, SY: 3, YE: 3,
  OM: 4, KW: 3, QA: 3, BH: 3, BT: 6, MV: 5, SO: 3,
};

export const DEFAULT_UTC_OFFSET = 5.5;

export function getCountryUtcOffset(countryCode?: string): number {
  if (!countryCode) return DEFAULT_UTC_OFFSET;
  return COUNTRY_UTC_OFFSETS[countryCode.toUpperCase()] ?? DEFAULT_UTC_OFFSET;
}
