/* SkyOps — Processing page data */

const PROC_JOBS = [
  {
    id: "JOB-2026-04-033.A", mic: "MIC-2026-04-033",
    sortie: "Sortie 09–14 · North cluster",
    site: "pt-ev-03", siteName: "Évora Plana PV",
    status: "processing", stream: "both", progress: 0.68,
    images: 4821, thermalImages: 2110, bytes: 847_200_000_000,
    startedAt: "2026-04-16 08:12", eta: "19m",
    engine: "GPU-04 · NodeODM",
    sfmPoints: 182_410, densePoints: 84_210_332,
    gsd: 1.24, area_ha: 412.4,
    flight: "FLT-2026-04-033.03", pilot: "Tomás Aragón", drone: "DJI M350 RTK",
    activeStage: 3, anomaliesDetected: 58, coverage: 92.4,
  },
  {
    id: "JOB-2026-04-033.B", mic: "MIC-2026-04-033",
    sortie: "Sortie 01–08 · South cluster",
    site: "pt-ev-03", siteName: "Évora Plana PV",
    status: "completed", stream: "both", progress: 1,
    images: 3908, thermalImages: 1702, bytes: 682_400_000_000,
    startedAt: "2026-04-15 14:05", eta: "—",
    engine: "GPU-04 · NodeODM",
    sfmPoints: 148_210, densePoints: 71_840_001,
    gsd: 1.18, area_ha: 318.6,
    activeStage: 8, anomaliesDetected: 1204, coverage: 98.2,
  },
  {
    id: "JOB-2026-04-029.A", mic: "MIC-2026-04-029",
    sortie: "Sortie · Inverter 3 cluster",
    site: "es-mu-02", siteName: "Lorca Photon Field",
    status: "completed", stream: "thermal", progress: 1,
    images: 1410, thermalImages: 1410, bytes: 114_200_000_000,
    startedAt: "2026-04-14 11:22", eta: "—",
    engine: "CPU · Local Docker",
    gsd: 1.8, area_ha: 82.1,
    activeStage: 8, anomaliesDetected: 214, coverage: 100,
  },
  {
    id: "JOB-2026-04-028.A", mic: "MIC-2026-04-028",
    sortie: "Sortie · Tracker rows 14–27",
    site: "es-zr-07", siteName: "Zaragoza North",
    status: "queued", stream: "rgb", progress: 0,
    images: 2210, thermalImages: 0, bytes: 322_800_000_000,
    startedAt: "—", eta: "queued",
    engine: "GPU-02 · NodeODM",
    gsd: null, area_ha: 180.4,
    activeStage: 0, anomaliesDetected: 0, coverage: 0,
  },
  {
    id: "JOB-2026-04-025.A", mic: "MIC-2026-04-025",
    sortie: "Sortie · Full site",
    site: "es-ab-01", siteName: "Albacete Solar I",
    status: "failed", stream: "both", progress: 0.41,
    images: 3102, thermalImages: 1300, bytes: 412_100_000_000,
    startedAt: "2026-04-11 09:18", eta: "—",
    engine: "GPU-04 · NodeODM",
    gsd: null, area_ha: 260.0,
    activeStage: 2, anomaliesDetected: 0, coverage: 0,
    error: "SfM stage — insufficient tie points in sector 4 (GPS drift > 4m)",
  },
];

const PROC_STAGES = [
  { key: "ingest",       name: "Ingest",               desc: "SD-card sync, EXIF validation",                  dur: "2m 14s", stream: "both" },
  { key: "validate",     name: "Validation",           desc: "GPS, timestamps, exposure, coverage",            dur: "1m 48s", stream: "both" },
  { key: "sfm",          name: "SfM",                  desc: "Structure from motion · camera poses",           dur: "14m 02s", stream: "rgb" },
  { key: "mvs",          name: "Dense reconstruction", desc: "MVS, depth maps, point cloud",                   dur: "32m 18s", stream: "rgb" },
  { key: "ortho",        name: "Ortho + DSM",          desc: "Orthomosaic & surface model",                    dur: "18m 55s", stream: "rgb" },
  { key: "registration", name: "Thermal register",     desc: "Thermal → RGB alignment, panel index",           dur: "6m 40s",  stream: "thermal" },
  { key: "anomaly",      name: "Anomaly detection",    desc: "Hot cell, bypass, PID, vegetation scoring",      dur: "11m 22s", stream: "thermal" },
  { key: "report",       name: "Post-process",         desc: "COG, COPC, 3D Tiles, PDF",                       dur: "4m 08s",  stream: "both" },
];

const PROC_OUTPUTS = [
  { key: "ortho",   label: "Orthophoto",          ext: ".tif",      tag: "COG",      size: "18.4 GB", stream: "rgb" },
  { key: "dsm",     label: "Surface Model",       ext: ".tif",      tag: "DSM",      size: "3.1 GB",  stream: "rgb" },
  { key: "dtm",     label: "Terrain Model",       ext: ".tif",      tag: "DTM",      size: "2.8 GB",  stream: "rgb" },
  { key: "pc",      label: "Point Cloud",         ext: ".copc.laz", tag: "COPC",     size: "12.6 GB", stream: "rgb" },
  { key: "mesh",    label: "Textured Mesh",       ext: ".glb",      tag: "3D Tiles", size: "4.2 GB",  stream: "rgb" },
  { key: "thermal", label: "Thermal Orthomosaic", ext: ".tif",      tag: "LWIR",     size: "6.2 GB",  stream: "thermal" },
  { key: "ndvi",    label: "Vegetation Index",    ext: ".tif",      tag: "NDVI",     size: "1.1 GB",  stream: "rgb" },
  { key: "kmz",     label: "Google Earth",        ext: ".kmz",      tag: "KMZ",      size: "28 MB",   stream: "both" },
  { key: "report",  label: "Quality Report",      ext: ".pdf",      tag: "IEC",      size: "4.4 MB",  stream: "both" },
];

const PROC_LOGS = [
  ["08:12:04","I","[ingest] connecting to DJI M350 · Serial 1581J7AEK0RX3..."],
  ["08:12:06","I","[ingest] mounted /mnt/m350-sd · 847.2 GB · 6,931 files"],
  ["08:12:07","D","[ingest] detected RGB=4,821  THERM=2,110"],
  ["08:12:12","I","[ingest] hashing imagery (xxh3-64)"],
  ["08:14:18","S","[ingest] ✔ 6,931/6,931  hash=0ad7b1f...  elapsed=2m 14s"],
  ["08:14:19","I","[validate] EXIF GPS parser · 6,931 frames"],
  ["08:14:58","W","[validate] 12 frames missing GPS · rejected"],
  ["08:15:02","W","[validate] 3 thermal/RGB pair mismatch (ts drift > 200ms)"],
  ["08:16:07","S","[validate] ✔ coverage est. 92.4% · GSD target 1.24 cm/px"],
  ["08:16:08","I","[sfm] opensfm · feature=dspsift  matcher=flann  sfm=incremental"],
  ["08:16:11","I","[sfm] extracting features · 4,806 frames · GPU-04"],
  ["08:19:42","D","[sfm] features: µ=8,214/frame   σ=1,042"],
  ["08:19:44","I","[sfm] pairwise matching · 11,537,448 pairs estimated"],
  ["08:26:18","I","[sfm] bundle adjustment · iter 0  residual=2.84"],
  ["08:27:35","I","[sfm] bundle adjustment · iter 1  residual=0.94"],
  ["08:28:49","I","[sfm] bundle adjustment · iter 2  residual=0.71"],
  ["08:30:10","S","[sfm] ✔ 4,806 cameras · 182,410 tie points · reproj=0.62px"],
  ["08:30:12","I","[mvs] odm dense reconstruction · quality=medium"],
  ["08:30:18","I","[mvs] depth map fusion · tile 0 / 144"],
  ["08:34:01","I","[mvs] depth map fusion · tile 32 / 144"],
  ["08:41:42","I","[mvs] depth map fusion · tile 88 / 144"],
  ["08:46:22","I","[mvs] generating dense point cloud · 84.2M pts"],
  ["08:48:18","S","[mvs] ✔ 84,210,332 points · density 212 pts/m² · elapsed=18m 06s"],
  ["08:48:19","I","[ortho] stitching orthomosaic · resolution 1.24 cm/px"],
  ["08:52:08","I","[ortho] dsm · triangulation · IDW smoothing"],
  ["08:55:44","I","[ortho] COG tiling · blocksize=512"],
  ["08:56:12","I","[registration] thermal alignment · ORB+affine"],
  ["08:58:01","D","[registration] panel string index built · 124,810 modules"],
  ["08:58:14","I","[anomaly] inference · model=skyops-fault-yolov11n v3.1"],
  ["08:58:45","D","[anomaly] GPU mem 9.6 / 16.0 GB · batch 24"],
  ["08:59:18","W","[anomaly] potential hot-cell cluster · sector 4.E (ΔT=28.4°C)"],
  ["09:01:40","I","[anomaly] 58 detections staged for review"],
];

window.PROC_JOBS = PROC_JOBS;
window.PROC_STAGES = PROC_STAGES;
window.PROC_OUTPUTS = PROC_OUTPUTS;
window.PROC_LOGS = PROC_LOGS;
