/* ============================================================
   data.js — constellation model (ESM)
   Группировка: ОПТИКА + ЛОКАЦИЯ, с группами КА.
   См. INTEGRATION.md — эти массивы предполагается заменить данными из API.
   ============================================================ */
export const COL = {
    optic: "#56c2c8",      // оптика — cyan
    radar: "#a78bdb",      // локация (РСА) — violet
  };

  // --- Satellites -------------------------------------------------
  // orbit: latAmp(deg amplitude of sub-sat latitude), period(min),
  //        phase(0..1 of period), lon0(deg start longitude)
  // mem0: initial onboard memory fill %
  const sats = [
    // ============ ОПТИКА ============
    { id: "res3",  name: "Ресурс-П №3",  norad: 41386, payload: "optic", domain: "ОПТИКА", group: "Ресурс-П",
      orbit: { latAmp: 81, period: 94.2, phase: 0.02, lon0: 12 },  mem0: 38 },
    { id: "res4",  name: "Ресурс-П №4",  norad: 41387, payload: "optic", domain: "ОПТИКА", group: "Ресурс-П",
      orbit: { latAmp: 81, period: 94.6, phase: 0.34, lon0: 155 }, mem0: 64 },
    { id: "res5",  name: "Ресурс-П №5",  norad: 41388, payload: "optic", domain: "ОПТИКА", group: "Ресурс-П",
      orbit: { latAmp: 81, period: 94.4, phase: 0.67, lon0: -98 }, mem0: 21 },
    { id: "kan6",  name: "Канопус-В №6", norad: 43657, payload: "optic", domain: "ОПТИКА", group: "Канопус-В",
      orbit: { latAmp: 78, period: 96.1, phase: 0.12, lon0: 64 },  mem0: 52 },
    { id: "kan7",  name: "Канопус-В №7", norad: 43658, payload: "optic", domain: "ОПТИКА", group: "Канопус-В",
      orbit: { latAmp: 78, period: 96.4, phase: 0.55, lon0: -150 }, mem0: 79 },

    // ============ ЛОКАЦИЯ (РСА) ============
    { id: "kon1",  name: "Кондор-ФКА №1", norad: 57350, payload: "radar", domain: "ЛОКАЦИЯ", group: "Кондор-ФКА",
      orbit: { latAmp: 74, period: 92.7, phase: 0.20, lon0: 33 },  mem0: 45 },
    { id: "kon2",  name: "Кондор-ФКА №2", norad: 62138, payload: "radar", domain: "ЛОКАЦИЯ", group: "Кондор-ФКА",
      orbit: { latAmp: 74, period: 92.9, phase: 0.62, lon0: 178 }, mem0: 17 },
    { id: "kon3",  name: "Кондор-ФКА №3", norad: 62139, payload: "radar", domain: "ЛОКАЦИЯ", group: "Кондор-ФКА",
      orbit: { latAmp: 74, period: 92.5, phase: 0.88, lon0: -70 }, mem0: 70 },
    { id: "obz1",  name: "Обзор-Р №1",    norad: 60001, payload: "radar", domain: "ЛОКАЦИЯ", group: "Обзор-Р",
      orbit: { latAmp: 67, period: 97.8, phase: 0.30, lon0: 100 }, mem0: 33 },
    { id: "obz2",  name: "Обзор-Р №2",    norad: 60002, payload: "radar", domain: "ЛОКАЦИЯ", group: "Обзор-Р",
      orbit: { latAmp: 67, period: 98.1, phase: 0.74, lon0: -25 }, mem0: 58 },
  ];
  sats.forEach((s) => { s.color = COL[s.payload]; });

  // --- Ground stations -------------------------------------------
  const stations = [
    { id: "msk", name: "Москва",       lon: 37.6,  lat: 55.7 },
    { id: "mur", name: "Мурманск",     lon: 33.1,  lat: 68.9 },
    { id: "ana", name: "Анадырь",      lon: 177.5, lat: 64.7 },
    { id: "kha", name: "Хабаровск",    lon: 135.1, lat: 48.5 },
    { id: "kgd", name: "Калининград",  lon: 20.5,  lat: 54.7 },
    { id: "svb", name: "Шпицберген",   lon: 15.6,  lat: 78.2 },
    { id: "ant", name: "Прогресс",     lon: 76.4,  lat: -69.4 },
  ];

  // --- Targets / ROIs (заявки на съёмку) -------------------------
  // rect helper: center + half-width/height in degrees
  function rect(lon, lat, hw, hh) {
    return [
      [lon - hw, lat - hh], [lon + hw, lat - hh],
      [lon + hw, lat + hh], [lon - hw, lat + hh],
    ];
  }
  const rois = [
    { id: "gib", name: "Гибралтар",     payload: "optic", poly: rect(-5.4, 36.0, 3.2, 2.4) },
    { id: "blk", name: "Чёрное море",   payload: "optic", poly: rect(34.0, 43.5, 6.0, 3.0) },
    { id: "jpn", name: "Японские о-ва", payload: "radar", poly: rect(140.5, 37.5, 3.4, 6.5) },
    { id: "kam", name: "Камчатка",      payload: "radar", poly: rect(159.0, 56.0, 4.5, 5.0) },
    { id: "cal", name: "Калифорния",    payload: "optic", poly: rect(-119.5, 36.5, 3.5, 4.5) },
    { id: "syr", name: "Сирия",         payload: "optic", poly: rect(38.5, 35.0, 3.0, 2.6) },
    { id: "sah", name: "о.Сахалин",     payload: "radar", poly: rect(143.0, 50.5, 2.2, 4.8) },
    { id: "kur", name: "Курилы",        payload: "radar", poly: rect(151.0, 46.0, 2.0, 3.6) },
  ];

export { sats as SATELLITES, stations as STATIONS, rois as ROIS };

