/** Per-step hero images (Unsplash). Order matches `workOrders.troubleshootTree.steps.<category>` in i18n. */

export type TroubleshootCategory =
  | 'air_conditioning'
  | 'power'
  | 'building_systems'
  | 'applications_account'
  | 'ultrasound';

/** auto=format&fit=crop keeps payloads small; w=960 matches card width. */
const q = 'auto=format&fit=crop&w=960&q=80';

export const TROUBLESHOOT_STEP_IMAGE_URLS: Record<TroubleshootCategory, readonly string[]> = {
  air_conditioning: [
    `https://images.unsplash.com/photo-1770625467384-304e461ef1be?${q}`,
    `https://images.unsplash.com/photo-1590620284812-3216c0ea0a75?${q}`,
    `https://images.unsplash.com/photo-1600607687939-ce8a6c25118c?${q}`,
    `https://images.unsplash.com/photo-1504917595217-d4dc5ebe6122?${q}`,
    `https://images.unsplash.com/photo-1770816306659-adcf99a11aeb?${q}`,
    `https://images.unsplash.com/photo-1585771724684-38269d6639fd?${q}`,
  ],
  power: [
    `https://images.unsplash.com/photo-1621905251918-48416bd8575a?${q}`,
    `https://images.unsplash.com/photo-1558618666-fcd25c85cd64?${q}`,
    `https://images.unsplash.com/photo-1558494949-ef010cbdcc31?${q}`,
    `https://images.unsplash.com/photo-1473341304170-971dccb5ac1e?${q}`,
    `https://images.unsplash.com/photo-1504917595217-d4dc5ebe6122?${q}`,
    `https://images.unsplash.com/photo-1621905251918-48416bd8575a?${q}`,
  ],
  building_systems: [
    `https://images.unsplash.com/photo-1600585154526-990dced4db0d?${q}`,
    `https://images.unsplash.com/photo-1502672260266-1c1ef2d93688?${q}`,
    `https://images.unsplash.com/photo-1556911220-e15b29be8c8f?${q}`,
    `https://images.unsplash.com/photo-1691465576659-938b08b99959?${q}`,
    `https://images.unsplash.com/photo-1556742049-0cfed4f6a45d?${q}`,
    `https://images.unsplash.com/photo-1497366754035-f200968a6e72?${q}`,
  ],
  applications_account: [
    `https://images.unsplash.com/photo-1460925895917-afdab827c52f?${q}`,
    `https://images.unsplash.com/photo-1544197150-b99a580bb7a8?${q}`,
    `https://images.unsplash.com/photo-1563013544-824ae1b704d3?${q}`,
    `https://images.unsplash.com/photo-1517694712202-14dd9538aa97?${q}`,
    `https://images.unsplash.com/photo-1555066931-4365d14bab8c?${q}`,
    `https://images.unsplash.com/photo-1544197150-b99a580bb7a8?${q}`,
  ],
  ultrasound: [
    // Step 1 — Power supply & environment: electrical plug into wall socket (verified)
    `https://images.unsplash.com/photo-1565049981953-379c9c2a5d48?${q}`,
    // Step 2 — Probe & transducer check: doctor in blue gloves operating ultrasound machine (verified)
    `https://images.unsplash.com/photo-1691933880037-ce9d151ab922?${q}`,
    // Step 3 — Image quality & monitor: hospital ICU monitor screen with readings (verified)
    `https://images.unsplash.com/photo-1624004015322-a94d3a4eff39?${q}`,
    // Step 4 — Shutdown & restart: server room cables and switches close-up (verified)
    `https://images.unsplash.com/photo-1667264501379-c1537934c7ab?${q}`,
    // Step 5 — Error codes & diagnostics: laptop with red error screen (verified)
    `https://images.unsplash.com/flagged/photo-1560854350-13c0b47a3180?${q}`,
    // Step 6 — Escalation to GE/SAMAMA: technician / support service call
    `https://images.unsplash.com/photo-1521791136064-7986c2920216?${q}`,
    // Step 7 — Printer troubleshooting: network / data center cables close-up (verified)
    `https://images.unsplash.com/photo-1691435828932-911a7801adfb?${q}`,
    // Step 8 — Network troubleshooting: ethernet cable LAN close-up (verified)
    `https://images.unsplash.com/photo-1578016980868-197203ff4b02?${q}`,
  ],
};

export function troubleshootStepImageUrl(category: TroubleshootCategory, stepIndex: number): string | undefined {
  const list = TROUBLESHOOT_STEP_IMAGE_URLS[category];
  if (!list || !list.length || stepIndex < 0) return undefined;
  return list[Math.min(stepIndex, list.length - 1)];
}