// flow-data.jsx — generic European logistics seed data

const SHIPMENTS = [
  {
    id: 'FL-2026-04812', mrn: '26TR0510120000128',
    lane: { from: 'Gebze, TR', to: 'Shumen, BG', fromCC: 'TUR', toCC: 'BGR', km: 1340 },
    status: 'in_transit', delayed: false,
    pickup: { planned: '2026-05-06 08:00', actual: '2026-05-06 09:15' },
    delivery: { planned: '2026-05-09 14:00', etaShift: '+2h' },
    carrier: 'Anatolia Lojistik A.Ş.',
    vehicle: '34 ABC 7821',
    driver: 'Hakan Yıldız',
    adr: { is: true, classes: ['3'] },
    gates: { sanctions: 'pass', lc: 'na', insurance: 'pass', export: 'pass', adr: 'pass' },
    freeTimeRisk: 'low',
    cargo: { weight: 18450, volume: 62, packages: 24, value: 84200, hsn: '2710.19' },
    docs: { eCMR: 'signed', mbl: 'issued', hbl: 'issued', msds: 'parsed', pod: 'pending', exA: 'issued' },
    invoiceVariance: 0.041,
  },
  {
    id: 'FL-2026-04811', mrn: '26TR4150100000091',
    lane: { from: 'Malatya, TR', to: 'Shumen, BG', fromCC: 'TUR', toCC: 'BGR', km: 1620 },
    status: 'blocked', delayed: false,
    pickup: { planned: '2026-05-08 06:30', actual: null },
    delivery: { planned: '2026-05-11 12:00' },
    carrier: 'Beyoğlu Transport Ltd.',
    vehicle: '06 EZ 4421',
    driver: 'Ali Demirci',
    adr: { is: false },
    gates: { sanctions: 'pass', lc: 'na', insurance: 'pass', export: 'fail', adr: 'na' },
    gateFailReason: 'Export license expired 2026-05-01',
    freeTimeRisk: 'low',
    cargo: { weight: 22100, volume: 78, packages: 36, value: 142800, hsn: '5407.61' },
    docs: { eCMR: 'draft', mbl: 'draft', hbl: 'missing', pod: 'missing', exA: 'missing' },
    invoiceVariance: null,
  },
  {
    id: 'FL-2026-04810',
    lane: { from: 'Hamburg, DE', to: 'Plovdiv, BG', fromCC: 'DEU', toCC: 'BGR', km: 2100 },
    status: 'delayed',
    pickup: { planned: '2026-05-04 14:00', actual: '2026-05-04 15:30' },
    delivery: { planned: '2026-05-09 09:00', etaShift: '+1d 4h' },
    carrier: 'Donau Logistik GmbH',
    vehicle: 'HH-DL 2204',
    driver: 'Markus Vogel',
    adr: { is: false },
    gates: { sanctions: 'pass', lc: 'pass', insurance: 'pass', export: 'pass' },
    freeTimeRisk: 'high',
    freeTimeBurn: 270, // €/day
    cargo: { weight: 14900, volume: 54, packages: 18, value: 67400 },
    docs: { eCMR: 'issued', pod: 'pending' },
    invoiceVariance: 0.18,
  },
  {
    id: 'FL-2026-04809',
    lane: { from: 'Mumbai, IN (sea)', to: 'Sofia, BG', fromCC: 'IND', toCC: 'BGR', km: 7800 },
    status: 'at_destination',
    pickup: { planned: '2026-04-12 00:00', actual: '2026-04-12 00:00' },
    delivery: { planned: '2026-05-08 18:00', etaShift: 'on time' },
    carrier: 'Maersk + Tirana Trans',
    vehicle: 'BG 4192 KH',
    driver: 'Ivan Petrov',
    adr: { is: false },
    gates: { sanctions: 'pass', lc: 'pass', insurance: 'pass' },
    freeTimeRisk: 'crit',
    freeTimeBurn: 540,
    cargo: { weight: 28200, volume: 110, packages: 1, value: 198000 },
    docs: { eCMR: 'issued', mbl: 'issued', hbl: 'issued', pod: 'pending' },
    invoiceVariance: 0.27,
  },
  {
    id: 'FL-2026-04808',
    lane: { from: 'Shenzhen, CN', to: 'Burgas, BG', fromCC: 'CHN', toCC: 'BGR', km: 9200 },
    status: 'in_transit',
    pickup: { planned: '2026-04-22 00:00', actual: '2026-04-22 00:00' },
    delivery: { planned: '2026-05-12 10:00', etaShift: 'on time' },
    carrier: 'COSCO + Sofia Cargo',
    vehicle: '—',
    driver: '—',
    adr: { is: false },
    gates: { sanctions: 'pass', lc: 'na', insurance: 'pass' },
    freeTimeRisk: 'low',
    cargo: { weight: 19400, volume: 68, packages: 12, value: 121000 },
    docs: { eCMR: 'draft', pod: 'missing' },
    invoiceVariance: null,
  },
  {
    id: 'FL-2026-04807',
    lane: { from: 'Istanbul, TR', to: 'Bucharest, RO', fromCC: 'TUR', toCC: 'ROU', km: 720 },
    status: 'delivered',
    pickup: { planned: '2026-05-02 07:00', actual: '2026-05-02 07:20' },
    delivery: { planned: '2026-05-04 11:00', etaShift: 'on time' },
    carrier: 'Anatolia Lojistik A.Ş.',
    vehicle: '34 KL 9912',
    driver: 'Zeynep Aksu',
    adr: { is: false },
    gates: { sanctions: 'pass', lc: 'na', insurance: 'pass', export: 'pass' },
    freeTimeRisk: 'low',
    cargo: { weight: 12200, volume: 42, packages: 14, value: 48900 },
    docs: { eCMR: 'signed', pod: 'signed' },
    invoiceVariance: 0.012,
  },
  {
    id: 'FL-2026-04806',
    lane: { from: 'Köln, DE', to: 'Sofia, BG', fromCC: 'DEU', toCC: 'BGR', km: 1880 },
    status: 'in_transit',
    pickup: { planned: '2026-05-05 09:00', actual: '2026-05-05 09:00' },
    delivery: { planned: '2026-05-09 16:00', etaShift: 'on time' },
    carrier: 'Donau Logistik GmbH',
    vehicle: 'K-DL 7711',
    driver: 'Sabine Hoffmann',
    adr: { is: true, classes: ['8'] },
    gates: { sanctions: 'pass', lc: 'na', insurance: 'pass', export: 'pass', adr: 'pass' },
    freeTimeRisk: 'low',
    cargo: { weight: 16800, volume: 58, packages: 22, value: 92000 },
    docs: { eCMR: 'signed', msds: 'parsed', pod: 'pending' },
    invoiceVariance: 0.06,
  },
  {
    id: 'FL-2026-04805',
    lane: { from: 'Warsaw, PL', to: 'Varna, BG', fromCC: 'POL', toCC: 'BGR', km: 1450 },
    status: 'planned',
    pickup: { planned: '2026-05-11 08:00', actual: null },
    delivery: { planned: '2026-05-14 14:00' },
    carrier: 'Polkargo S.A.',
    vehicle: 'WAW 91KP',
    driver: 'Marcin Lewandowski',
    adr: { is: false },
    gates: { sanctions: 'pass', lc: 'pass', insurance: 'pass', export: 'pass' },
    freeTimeRisk: 'low',
    cargo: { weight: 21000, volume: 72, packages: 30, value: 78400 },
    docs: { eCMR: 'draft' },
    invoiceVariance: null,
  },
  {
    id: 'FL-2026-04804',
    lane: { from: 'Milan, IT', to: 'Sofia, BG', fromCC: 'ITA', toCC: 'BGR', km: 1620 },
    status: 'ready_to_dispatch',
    pickup: { planned: '2026-05-10 06:00', actual: null },
    delivery: { planned: '2026-05-13 18:00' },
    carrier: 'Brennero Express SrL',
    vehicle: 'MI 88RT',
    driver: 'Luca Bianchi',
    adr: { is: false },
    gates: { sanctions: 'pass', lc: 'na', insurance: 'pass', export: 'pass' },
    freeTimeRisk: 'low',
    cargo: { weight: 9400, volume: 38, packages: 12, value: 56700 },
    docs: { eCMR: 'issued' },
    invoiceVariance: null,
  },
  {
    id: 'FL-2026-04803',
    lane: { from: 'Lyon, FR', to: 'Sofia, BG', fromCC: 'FRA', toCC: 'BGR', km: 2050 },
    status: 'in_transit',
    pickup: { planned: '2026-05-04 10:00', actual: '2026-05-04 10:00' },
    delivery: { planned: '2026-05-09 13:00', etaShift: '+4h' },
    carrier: 'Rhône Cargo',
    vehicle: '69 RC 3304',
    driver: 'Claude Mercier',
    adr: { is: true, classes: ['9'] },
    gates: { sanctions: 'pass', lc: 'na', insurance: 'warn', export: 'pass', adr: 'pass' },
    gateWarnReason: 'Insurance expires in 21 days',
    freeTimeRisk: 'low',
    cargo: { weight: 15600, volume: 51, packages: 19, value: 71200 },
    docs: { eCMR: 'signed', msds: 'parsed', pod: 'pending' },
    invoiceVariance: 0.03,
  },
  {
    id: 'FL-2026-04802',
    lane: { from: 'Rotterdam, NL', to: 'Burgas, BG', fromCC: 'NLD', toCC: 'BGR', km: 2240 },
    status: 'delivered',
    pickup: { planned: '2026-04-29 12:00', actual: '2026-04-29 12:30' },
    delivery: { planned: '2026-05-04 09:00', etaShift: 'on time' },
    carrier: 'Lowlands Freight BV',
    vehicle: 'NL 41-XV-22',
    driver: 'Jan de Vries',
    adr: { is: false },
    gates: { sanctions: 'pass', lc: 'pass', insurance: 'pass', export: 'pass' },
    freeTimeRisk: 'low',
    cargo: { weight: 11200, volume: 44, packages: 16, value: 38900 },
    docs: { eCMR: 'signed', pod: 'signed' },
    invoiceVariance: -0.008,
  },
  {
    id: 'FL-2026-04801',
    lane: { from: 'Athens, GR', to: 'Sofia, BG', fromCC: 'GRC', toCC: 'BGR', km: 820 },
    status: 'reconciled',
    pickup: { planned: '2026-04-25 08:00', actual: '2026-04-25 08:00' },
    delivery: { planned: '2026-04-26 16:00', etaShift: 'on time' },
    carrier: 'Olympic Logistics',
    vehicle: 'AB 2202 EE',
    driver: 'Dimitris Pappas',
    adr: { is: false },
    gates: { sanctions: 'pass', lc: 'na', insurance: 'pass', export: 'pass' },
    freeTimeRisk: 'low',
    cargo: { weight: 8400, volume: 30, packages: 10, value: 24300 },
    docs: { eCMR: 'signed', pod: 'signed' },
    invoiceVariance: 0.0,
  },
];

const ALERTS = [
  {
    id: 'a1', sev: 'danger', icon: 'alert',
    title: 'Dispatch blocked — export license expired',
    body: 'FL-2026-04811 (Malatya → Shumen). Re-issue Beyanname or update license before pickup window closes in 22 h.',
    shipment: 'FL-2026-04811', cta: 'Open shipment',
    age: '8 min',
  },
  {
    id: 'a2', sev: 'danger', icon: 'stamp',
    title: 'MRN seizure — Kapıkule customs',
    body: '26TR0510120000128 (FL-2026-04812) flagged: A.TR reference number missing on accompanying eCMR.',
    shipment: 'FL-2026-04812', cta: 'Contact broker',
    age: '34 min',
  },
  {
    id: 'a3', sev: 'warning', icon: 'clock',
    title: 'Detention clock at 91% — Burgas Port',
    body: 'FL-2026-04809 (Maersk container MSCU-7714823). Free-time expires in 5 h 12 min · accruing €540/day after.',
    shipment: 'FL-2026-04809', cta: 'Resolve',
    age: '52 min',
  },
  {
    id: 'a4', sev: 'warning', icon: 'euro',
    title: 'Invoice variance 27% over expected',
    body: 'Maersk INV-2026-44128 — €1,840 over the lane benchmark from TradeShield. Detention 2 d × €540.',
    shipment: 'FL-2026-04809', cta: 'Review',
    age: '1 h',
  },
  {
    id: 'a5', sev: 'warning', icon: 'shield',
    title: 'Claim notification deadline approaching',
    body: 'CL-2026-0143 — short delivery 220 kg. 7-day road-claim window closes in 1 d 6 h.',
    shipment: 'FL-2026-04802', cta: 'File notice',
    age: '3 h',
  },
  {
    id: 'a6', sev: 'success', icon: 'check',
    title: 'POD captured — Bucharest delivery',
    body: 'FL-2026-04807 signed by S. Iliescu at 11:08. Now eligible for reconciliation.',
    shipment: 'FL-2026-04807', cta: 'Reconcile',
    age: '4 h',
  },
];

const ACTIVE_CLOCKS = [
  { id: 'cl-1', shipment: 'FL-2026-04809', type: 'demurrage', counterparty: 'Maersk', location: 'Burgas Port',
    started: '2026-05-04 14:20', freeHours: 120, usedHours: 109, ratePerDay: 540, currency: 'EUR' },
  { id: 'cl-2', shipment: 'FL-2026-04810', type: 'detention', counterparty: 'Donau Logistik',
    location: 'Plovdiv yard', started: '2026-05-07 09:00', freeHours: 48, usedHours: 39, ratePerDay: 270, currency: 'EUR' },
  { id: 'cl-3', shipment: 'FL-2026-04806', type: 'storage', counterparty: 'Sofia ICT',
    location: 'Sofia depot',  started: '2026-05-05 18:30', freeHours: 72, usedHours: 38, ratePerDay: 95, currency: 'EUR' },
  { id: 'cl-4', shipment: 'FL-2026-04812', type: 'driver', counterparty: 'Anatolia Lojistik',
    location: 'Kapıkule border', started: '2026-05-08 04:10', freeHours: 4, usedHours: 3.6, ratePerDay: 360, currency: 'EUR' },
  { id: 'cl-5', shipment: 'FL-2026-04803', type: 'detention', counterparty: 'Rhône Cargo',
    location: 'Sofia consignee', started: '2026-05-08 16:00', freeHours: 48, usedHours: 12, ratePerDay: 240, currency: 'EUR' },
  { id: 'cl-6', shipment: 'FL-2026-04808', type: 'demurrage', counterparty: 'COSCO',
    location: 'Burgas Port', started: '2026-05-07 22:00', freeHours: 168, usedHours: 50, ratePerDay: 480, currency: 'EUR' },
];

const TIMELINE_EVENTS = [
  { ts: '2026-05-09 06:42', type: 'gate', actor: 'system', text: 'Gate G6 ADR re-checked: pass (cert 2027-03-12).', icon: 'shield', tone: 'success' },
  { ts: '2026-05-08 22:05', type: 'customs', actor: 'system', text: 'Transit declaration accepted at Kapıkule customs. MRN 26TR0510120000128.', icon: 'stamp', tone: 'success' },
  { ts: '2026-05-08 19:30', type: 'status', actor: 'system', text: 'Status changed: dispatched → in_transit.', icon: 'truck', tone: 'primary' },
  { ts: '2026-05-08 14:12', type: 'doc', actor: 'Elif Özay', text: 'eCMR generated and issued (v2). 22 fields auto-filled from lane.', icon: 'fileCheck', tone: 'primary' },
  { ts: '2026-05-08 09:00', type: 'gate', actor: 'system', text: 'Pre-dispatch gates run. 5/5 pass.', icon: 'check', tone: 'success' },
];

window.FLOW_DATA = { SHIPMENTS, ALERTS, ACTIVE_CLOCKS, TIMELINE_EVENTS };
