// ═══ Korean Submarine Cable Data ═══
// Source: TeleGeography / submarinecablemap.com
// Major submarine cables landing in South Korea

export interface SubmarineCable {
  id: string;
  name: string;
  color: string;
  landingPoints: string[];       // city names
  rfsYear?: number;              // ready for service year
  length?: string;               // e.g. "36,500 km"
  owners?: string;
  route: [number, number][];     // [lng, lat] pairs for the cable path
}

// ── Route reference ──
// Korea Strait: 129.5°E between Korea & Tsushima (water)
// Tsushima-Kyushu channel: ~129.8-130.2°E, 33.5-34°N (water)
// West of Kyushu (Goto-Nagasaki gap): ~129.3°E, 31-33°N (water)
// South of Kyushu (Cape Sata): below 30.8°N when 130-131°E
// South of Shikoku: below 32.5°N when 132-135°E
// South of Kii/Izu: below 33°N when 135-139°E
// Korea south coast: below 33.8°N between 126-129°E = open sea

export const KOREA_SUBMARINE_CABLES: SubmarineCable[] = [
  // ═══ Southbound cables (Busan → Korea Strait → East China Sea → south) ═══
  {
    id: 'apcn-2',
    name: 'APCN-2',
    color: '#e91e63',
    landingPoints: ['부산', '일본', '중국', '대만', '필리핀', '싱가포르', '말레이시아'],
    rfsYear: 2001,
    length: '19,000 km',
    owners: 'KT, NTT, China Telecom 등',
    route: [
      [129.08, 35.18],   // Busan coast
      [129.5, 34.5],     // Korea Strait (water between Korea & Tsushima)
      [129.8, 33.8],     // Tsushima-Kyushu channel (water)
      [129.3, 32.5],     // West of Kyushu (Goto-Nagasaki gap, water)
      [129.0, 31.0],     // West of Kyushu south (water)
      [128.5, 29.5],     // South of Kyushu (open sea)
      [127.0, 27.0],     // East China Sea
      [125.0, 25.0],     // East China Sea
      [123.5, 23.0],     // East of Taiwan (sea)
      [121.5, 21.0],     // South of Taiwan (sea)
      [119.5, 18.5],     // Luzon Strait
      [117.5, 15.0],     // South China Sea
      [115.0, 10.5],     // South China Sea
      [111.5, 6.0],      // South China Sea
      [107.0, 3.0],      // Approach Singapore
      [104.0, 1.3],      // Singapore coast
    ],
  },
  {
    id: 'apg',
    name: 'APG (Asia Pacific Gateway)',
    color: '#2196f3',
    landingPoints: ['부산', '일본', '중국', '대만', '홍콩', '베트남', '태국', '말레이시아', '싱가포르'],
    rfsYear: 2016,
    length: '10,400 km',
    owners: 'KT, NTT, China Telecom, VNPT 등',
    route: [
      [129.08, 35.18],   // Busan coast
      [129.4, 34.4],     // Korea Strait
      [129.7, 33.7],     // Tsushima-Kyushu channel
      [129.2, 32.3],     // West of Kyushu (water)
      [128.8, 30.8],     // South of Kyushu (water)
      [127.5, 28.5],     // East China Sea
      [125.5, 26.0],     // East China Sea
      [123.5, 24.0],     // East of Taiwan (sea)
      [121.8, 21.5],     // South Taiwan (sea)
      [119.0, 19.5],     // Luzon Strait
      [116.5, 18.5],     // South China Sea
      [114.5, 22.0],     // Hong Kong approach (sea)
      [113.0, 18.0],     // South China Sea
      [110.0, 14.0],     // Off Vietnam (sea)
      [108.5, 11.0],     // Off South Vietnam (sea)
      [106.5, 7.0],      // South China Sea
      [104.5, 2.5],      // Approach Singapore
      [104.0, 1.3],      // Singapore coast
    ],
  },
  {
    id: 'eac-c2c',
    name: 'EAC-C2C',
    color: '#ff9800',
    landingPoints: ['부산', '일본', '중국', '필리핀', '싱가포르'],
    rfsYear: 2002,
    length: '36,500 km',
    owners: 'KT 등',
    route: [
      [129.08, 35.18],   // Busan coast
      [129.6, 34.6],     // Korea Strait
      [130.0, 33.9],     // Tsushima-Kyushu channel
      [129.5, 32.8],     // West Kyushu coast (water)
      [129.0, 31.2],     // West of Kyushu south (water)
      [128.0, 29.0],     // East China Sea
      [126.0, 26.5],     // East China Sea
      [124.0, 24.0],     // East of Taiwan (sea)
      [122.5, 21.0],     // South Taiwan (sea)
      [121.0, 18.0],     // Luzon Strait
      [120.0, 14.5],     // West of Luzon (sea)
      [117.5, 10.5],     // South China Sea
      [113.0, 6.0],      // South China Sea
      [108.0, 3.5],      // South China Sea
      [104.0, 1.3],      // Singapore coast
    ],
  },
  {
    id: 'flag-north-asia',
    name: 'FLAG/REACH North Asia Loop',
    color: '#9c27b0',
    landingPoints: ['부산', '일본', '홍콩', '중국'],
    rfsYear: 2002,
    length: '11,500 km',
    owners: 'Reliance Globalcom',
    route: [
      [129.08, 35.18],   // Busan coast
      [129.5, 34.5],     // Korea Strait
      [129.9, 33.8],     // Tsushima-Kyushu channel
      [129.4, 32.5],     // West Kyushu (water)
      [129.0, 31.0],     // South of Kyushu (water)
      [127.0, 28.0],     // East China Sea
      [124.5, 25.5],     // East China Sea
      [122.5, 23.0],     // East of Taiwan (sea)
      [121.0, 21.0],     // South Taiwan (sea)
      [118.0, 19.5],     // South China Sea
      [115.5, 21.0],     // Approach Hong Kong
      [114.2, 22.0],     // Hong Kong coast
    ],
  },
  {
    id: 'sjc',
    name: 'SJC (SE Asia-Japan Cable)',
    color: '#8bc34a',
    landingPoints: ['부산', '일본', '중국', '홍콩', '필리핀', '싱가포르'],
    rfsYear: 2013,
    length: '8,900 km',
    owners: 'KT, Google, China Mobile 등',
    route: [
      [129.08, 35.18],   // Busan coast
      [129.4, 34.4],     // Korea Strait
      [129.7, 33.6],     // Tsushima-Kyushu channel
      [129.2, 32.0],     // West Kyushu (water)
      [128.5, 30.5],     // South of Kyushu (water)
      [126.5, 27.5],     // East China Sea
      [124.0, 25.0],     // East China Sea
      [122.5, 22.5],     // East of Taiwan (sea)
      [121.0, 20.5],     // South Taiwan (sea)
      [118.0, 19.0],     // South China Sea
      [115.0, 21.5],     // Approach Hong Kong
      [114.2, 22.0],     // Hong Kong coast
      [113.5, 18.5],     // South China Sea
      [112.0, 13.0],     // South China Sea
      [110.0, 7.5],      // South China Sea
      [106.5, 3.5],      // Approach Singapore
      [104.0, 1.3],      // Singapore coast
    ],
  },
  {
    id: 'sjc2',
    name: 'SJC2',
    color: '#03a9f4',
    landingPoints: ['부산', '일본', '중국', '대만', '싱가포르', '태국'],
    rfsYear: 2022,
    length: '10,500 km',
    owners: 'KT, China Mobile, Facebook, KDDI 등',
    route: [
      [129.08, 35.18],   // Busan coast
      [129.5, 34.5],     // Korea Strait
      [129.8, 33.7],     // Tsushima-Kyushu channel
      [129.3, 32.3],     // West Kyushu (water)
      [128.8, 30.8],     // South of Kyushu (water)
      [127.0, 28.0],     // East China Sea
      [125.0, 25.5],     // East China Sea
      [123.0, 23.5],     // East of Taiwan (sea)
      [121.5, 21.5],     // South Taiwan (sea)
      [119.0, 19.5],     // South China Sea
      [116.0, 21.5],     // Approach Hong Kong
      [114.5, 22.0],     // Hong Kong area
      [113.0, 17.5],     // South China Sea
      [110.0, 12.5],     // South China Sea
      [107.5, 8.0],      // South China Sea
      [105.0, 3.5],      // Approach Singapore
      [104.0, 1.3],      // Singapore coast
    ],
  },

  // ═══ Japan direct cable ═══
  {
    id: 'kjcn',
    name: 'KJCN (Korea-Japan Cable)',
    color: '#4caf50',
    landingPoints: ['부산', '기타큐슈(일본)'],
    rfsYear: 2003,
    length: '230 km',
    owners: 'KT, KDDI',
    route: [
      [129.08, 35.18],   // Busan coast
      [129.5, 34.8],     // Korea Strait mid
      [129.9, 34.4],     // Strait (water)
      [130.3, 34.1],     // Approaching Kyushu north coast
      [130.9, 33.9],     // Kitakyushu coast
    ],
  },

  // ═══ Pacific cables (Busan → Korea Strait → south of Japan → Pacific) ═══
  {
    id: 'tpe',
    name: 'TPE (Trans-Pacific Express)',
    color: '#00bcd4',
    landingPoints: ['거제', '일본', '중국', '대만', '미국'],
    rfsYear: 2008,
    length: '17,700 km',
    owners: 'KT, China Telecom, Verizon 등',
    route: [
      [128.62, 34.88],   // Geoje coast
      [129.3, 34.3],     // Korea Strait
      [129.7, 33.7],     // Tsushima-Kyushu channel
      [129.3, 32.2],     // West Kyushu (water)
      [129.0, 31.0],     // SW of Kyushu (water)
      [129.5, 30.0],     // South of Cape Sata (open sea)
      [131.5, 30.0],     // SE of Kyushu (open sea)
      [134.0, 30.5],     // South of Shikoku (sea, <32.5°N)
      [137.0, 31.5],     // South of Kii (sea, <33°N)
      [140.0, 32.0],     // South of Izu (sea, <33°N)
      [143.0, 33.0],     // Off east Honshu (sea)
      [148.0, 35.5],     // North Pacific
      [158.0, 38.0],     // North Pacific
      [170.0, 40.0],     // Mid Pacific
      [-170.0, 42.0],    // Mid Pacific
      [-155.0, 41.0],    // Mid Pacific
      [-140.0, 39.0],    // East Pacific
      [-130.0, 38.0],    // Approach US
      [-122.4, 37.8],    // US West Coast
    ],
  },
  {
    id: 'ncp',
    name: 'NCP (New Cross Pacific)',
    color: '#ffeb3b',
    landingPoints: ['부산', '일본', '미국'],
    rfsYear: 2018,
    length: '13,600 km',
    owners: 'KT, Amazon, Microsoft 등',
    route: [
      [129.08, 35.18],   // Busan coast
      [129.5, 34.5],     // Korea Strait
      [129.8, 33.8],     // Tsushima-Kyushu channel
      [129.4, 32.5],     // West Kyushu (water)
      [129.0, 31.0],     // SW of Kyushu (water)
      [129.8, 30.0],     // South of Cape Sata (sea)
      [132.0, 30.0],     // SE of Kyushu (sea)
      [135.0, 30.5],     // South of Shikoku (sea)
      [138.0, 31.0],     // South of Kii (sea)
      [141.0, 32.0],     // South of Izu (sea)
      [144.0, 33.5],     // Off east Honshu (sea)
      [150.0, 37.0],     // North Pacific
      [160.0, 40.0],     // North Pacific
      [172.0, 43.0],     // Mid Pacific
      [-170.0, 45.5],    // Mid Pacific
      [-155.0, 45.0],    // Mid Pacific
      [-140.0, 43.0],    // East Pacific
      [-130.0, 42.0],    // Approach US
      [-125.0, 40.5],    // Near US
      [-122.3, 37.4],    // US West Coast
    ],
  },

  // ═══ GOKI (Incheon → Yellow Sea → south → Okinawa → Guam) ═══
  {
    id: 'goki',
    name: 'GOKI',
    color: '#ff5722',
    landingPoints: ['인천', '오키나와', '괌'],
    rfsYear: 2020,
    length: '3,400 km',
    owners: 'KT 등',
    route: [
      [126.59, 37.46],   // Incheon coast
      [126.0, 36.5],     // Yellow Sea (open water, west of Korea)
      [125.5, 35.5],     // Yellow Sea
      [125.0, 34.5],     // Yellow Sea south
      [125.0, 33.5],     // South of Korea (open sea, south of Jeju)
      [125.5, 32.0],     // East China Sea
      [126.5, 30.0],     // East China Sea
      [127.5, 27.5],     // Ryukyu arc
      [127.8, 26.3],     // Okinawa coast
      [129.0, 23.0],     // Philippine Sea
      [133.0, 19.0],     // Philippine Sea
      [138.0, 16.0],     // Philippine Sea
      [144.8, 13.5],     // Guam coast
    ],
  },

  // ═══ China direct cables (Yellow Sea crossing) ═══
  {
    id: 'c2c',
    name: 'C2C (China-Korea)',
    color: '#f44336',
    landingPoints: ['태안', '칭다오(중국)'],
    rfsYear: 2001,
    length: '1,100 km',
    owners: 'KT, China Netcom',
    route: [
      [126.35, 36.75],   // Taean coast (west coast Korea)
      [125.5, 36.5],     // Yellow Sea
      [124.0, 36.0],     // Yellow Sea mid
      [122.5, 35.8],     // Yellow Sea
      [121.0, 36.0],     // Approach Qingdao
      [120.4, 36.1],     // Qingdao coast
    ],
  },
  {
    id: 'ckc',
    name: 'CKC (China-Korea Cable)',
    color: '#ff7043',
    landingPoints: ['태안', '상하이(중국)'],
    rfsYear: 2006,
    length: '1,300 km',
    owners: 'KT, China Telecom',
    route: [
      [126.35, 36.75],   // Taean coast (west coast Korea)
      [125.5, 36.0],     // Yellow Sea
      [124.5, 35.0],     // Yellow Sea mid
      [123.5, 34.0],     // Yellow Sea south
      [123.0, 33.0],     // East China Sea
      [122.5, 32.0],     // East China Sea
      [122.0, 31.5],     // Approach Shanghai
      [121.8, 31.2],     // Shanghai coast
    ],
  },
  {
    id: 'flag-fea',
    name: 'FEA (Flag Europe Asia)',
    color: '#ab47bc',
    landingPoints: ['부산', '상하이(중국)', '홍콩'],
    rfsYear: 2001,
    length: '28,000 km',
    owners: 'Reliance Globalcom',
    route: [
      [129.08, 35.18],   // Busan coast
      [128.0, 34.8],     // South Sea (water, south of coast)
      [127.0, 34.5],     // South Sea
      [126.0, 33.8],     // South of Jeju area (water)
      [125.0, 33.0],     // East China Sea
      [124.0, 32.0],     // East China Sea
      [123.0, 31.5],     // Approach Shanghai
      [121.8, 31.2],     // Shanghai coast
    ],
  },

  // ═══ Domestic cables ═══
  {
    id: 'jeju-mainland-2',
    name: '제주-본토 해저케이블 2',
    color: '#e0e0e0',
    landingPoints: ['제주', '해남(전남)'],
    rfsYear: 2013,
    owners: 'KT',
    route: [
      [126.53, 33.51],   // Jeju north coast
      [126.50, 33.75],   // Jeju Strait
      [126.48, 34.00],   // Jeju Strait mid
      [126.50, 34.25],   // Approach mainland
      [126.57, 34.57],   // Haenam coast
    ],
  },
  {
    id: 'jeju-mainland-3',
    name: '제주-본토 해저케이블 3',
    color: '#bdbdbd',
    landingPoints: ['제주', '진도(전남)'],
    rfsYear: 2019,
    owners: 'KT',
    route: [
      [126.53, 33.51],   // Jeju north coast
      [126.30, 33.80],   // Jeju Strait west
      [126.15, 34.10],   // Jeju Strait mid
      [126.20, 34.35],   // Approach Jindo
      [126.26, 34.49],   // Jindo coast
    ],
  },
  {
    id: 'ulleung-mainland',
    name: '울릉-본토 해저케이블',
    color: '#90a4ae',
    landingPoints: ['울릉도', '포항'],
    rfsYear: 2016,
    owners: 'KT',
    route: [
      [130.91, 37.48],   // Ulleungdo coast
      [130.50, 37.15],   // East Sea
      [130.10, 36.75],   // East Sea
      [129.70, 36.35],   // Approach Pohang
      [129.34, 36.02],   // Pohang coast
    ],
  },
];

// Landing points in Korea for marker display
export interface CableLandingPoint {
  name: string;
  lat: number;
  lng: number;
  cables: string[];  // cable IDs
}

export const KOREA_LANDING_POINTS: CableLandingPoint[] = [
  { name: '부산', lat: 35.18, lng: 129.08, cables: ['apcn-2', 'apg', 'eac-c2c', 'kjcn', 'flag-north-asia', 'ncp', 'sjc', 'sjc2', 'flag-fea'] },
  { name: '거제', lat: 34.88, lng: 128.62, cables: ['tpe'] },
  { name: '태안', lat: 36.75, lng: 126.35, cables: ['c2c', 'ckc'] },
  { name: '인천', lat: 37.46, lng: 126.59, cables: ['goki'] },
  { name: '제주', lat: 33.51, lng: 126.53, cables: ['jeju-mainland-2', 'jeju-mainland-3'] },
  { name: '해남', lat: 34.57, lng: 126.57, cables: ['jeju-mainland-2'] },
  { name: '진도', lat: 34.49, lng: 126.26, cables: ['jeju-mainland-3'] },
  { name: '울릉도', lat: 37.48, lng: 130.91, cables: ['ulleung-mainland'] },
  { name: '포항', lat: 36.02, lng: 129.34, cables: ['ulleung-mainland'] },
];
