/* Viamar Ops — mock operations data */

// Pending quotes awaiting agent review (the team's half of the loop)
const OPS_QUOTES = [
  {
    id: 'VMR-48090', customer: 'Klajdi Hoxha', email: 'klajdi.h@email.com', cargo: 'Household goods — 6 pallets', cargoType: 'box',
    from: 'Calgary, AB', to: 'Lisbon, PT', method: 'LCL Consolidated', service: 'intl',
    aiVol: '11.2 m³', aiPrice: 1320, submitted: '2h ago', sla: 'Due in 1h',
    breakdown: [['Ocean / line freight', 818], ['Door pickup & handling', 238], ['Documentation & customs', 158], ['Cargo insurance (declined)', 0]],
    checks: [['ICS2 consignee details', true], ['Prohibited-items declaration', true], ['Commercial invoice', false], ['Prepayment authorised', true]],
  },
  {
    id: 'VMR-48233', customer: 'Daniel Owusu', email: 'd.owusu@email.com', cargo: 'Toyota Tacoma · 2022', cargoType: 'car',
    from: 'Toronto, ON', to: 'Tema, GH', method: 'Shared container', service: 'intl',
    aiVol: '~12 m³', aiPrice: 1850, submitted: '1h ago', sla: 'Due in 2h',
    breakdown: [['Ocean / line freight', 1147], ['Door pickup & handling', 333], ['Documentation & customs', 222], ['Cargo insurance (est.)', 148]],
    checks: [['Vehicle paid in full', true], ['Ownership / registration', true], ['Bill of sale', false], ['Canadian ID', true]],
  },
  {
    id: 'VMR-48241', customer: 'Aisha Nasser', email: 'aisha.n@email.com', cargo: '2 pallets + sofa', cargoType: 'box',
    from: 'Vancouver, BC', to: 'Calgary, AB', method: 'Shared container', service: 'domestic',
    aiVol: '4.1 m³', aiPrice: 580, submitted: '25m ago', sla: 'Due in 3h',
    breakdown: [['Line freight', 360], ['Pickup & handling', 104], ['Documentation', 70], ['Insurance (declined)', 0]],
    checks: [['Prohibited-items declaration', true], ['Pickup address confirmed', true], ['Prepayment authorised', false]],
  },
];

// Active shipments by pipeline stage
const OPS_STAGES = ['Booked', 'Pickup', 'Warehouse', 'Loaded', 'Sailing', 'Customs', 'Delivered'];
const OPS_PIPELINE = [
  { id: 'VMR-48217', customer: 'Alessandro M.', cargo: 'BMW M4 Competition', cargoType: 'car', to: 'Bremerhaven, DE', agent: 'Marco', stage: 'Sailing', eta: 'Jun 14', vessel: 'MV Atlantic Crown', photos: 32, seal: 'BR-7741' },
  { id: 'VMR-48155', customer: 'Priya R.', cargo: 'Mercedes GLE', cargoType: 'car', to: 'Sydney, AU', agent: 'Marco', stage: 'Warehouse', eta: 'Aug 02', vessel: '—', photos: 0, seal: '—' },
  { id: 'VMR-48201', customer: 'Tomas V.', cargo: 'Household — 4 pallets', cargoType: 'box', to: 'Genoa, IT', agent: 'Lena', stage: 'Loaded', eta: 'Jun 22', vessel: 'MV Ligurian', photos: 18, seal: 'GE-3380' },
  { id: 'VMR-48188', customer: 'Grace A.', cargo: 'Harley Softail', cargoType: 'bike', to: 'Kingston, JM', agent: 'Lena', stage: 'Pickup', eta: 'Jul 09', vessel: '—', photos: 0, seal: '—' },
  { id: 'VMR-48160', customer: 'Yusuf K.', cargo: 'Range Rover Sport', cargoType: 'car', to: 'Lagos, NG', agent: 'Marco', stage: 'Customs', eta: 'Jun 06', vessel: 'MV Gulf Trader', photos: 27, seal: 'LA-9912' },
  { id: 'VMR-48142', customer: 'Elena S.', cargo: 'Household — 2 pallets', cargoType: 'box', to: 'Lisbon, PT', agent: 'Lena', stage: 'Booked', eta: 'Jul 18', vessel: '—', photos: 0, seal: '—' },
  { id: 'VMR-47788', customer: 'Andre B.', cargo: 'Harley Road Glide', cargoType: 'bike', to: 'Kingston, JM', agent: 'Marco', stage: 'Delivered', eta: 'Apr 22', vessel: 'MV Caribbean Star', photos: 28, seal: 'KI-5521' },
];

// Support inbox threads
const OPS_THREADS = [
  { id: 't1', customer: 'Alessandro M.', ship: 'VMR-48217', last: "Where's my car right now?", time: '4m', unread: true, avatar: 'A',
    msgs: [{ from: 'cust', t: "Hi, where's my car right now?", time: '9:30 AM' }, { from: 'cust', t: 'Also when will it reach Bremerhaven?', time: '9:30 AM' }] },
  { id: 't2', customer: 'Daniel Owusu', ship: 'VMR-48233', last: 'Uploaded the bill of sale ✅', time: '22m', unread: true, avatar: 'D',
    msgs: [{ from: 'cust', t: 'Just uploaded the bill of sale — can you check it?', time: '9:12 AM' }] },
  { id: 't3', customer: 'Priya R.', ship: 'VMR-48155', last: 'Thanks Marco!', time: '1h', unread: false, avatar: 'P',
    msgs: [{ from: 'cust', t: 'Is my Mercedes at the warehouse yet?', time: '8:40 AM' }, { from: 'agent', t: 'Yes — arrived this morning, loading next week.', time: '8:45 AM' }, { from: 'cust', t: 'Thanks Marco!', time: '8:46 AM' }] },
  { id: 't4', customer: 'Tomas V.', ship: 'VMR-48201', last: 'Great, the photos look perfect', time: '3h', unread: false, avatar: 'T',
    msgs: [{ from: 'cust', t: 'Got the loading photos, they look perfect 👌', time: '6:50 AM' }] },
];

// KPIs
const OPS_KPIS = [
  { label: 'Quotes to review', value: '3', sub: '1 SLA-critical', icon: 'spark', tone: 'red' },
  { label: 'Active shipments', value: '12', sub: '4 sailing now', icon: 'ship', tone: 'navy' },
  { label: 'Sailings this week', value: '2', sub: 'EU Thu · Carib Tue', icon: 'anchor', tone: 'navy' },
  { label: 'Revenue · MTD', value: '$248k', sub: '+18% vs last mo', icon: 'doc', tone: 'green' },
  { label: 'Demurrage alerts', value: '1', sub: 'CN rail · Lagos', icon: 'clock', tone: 'amber' },
];

// PostHog-style funnel + analytics (the quote → booking funnel)
const PH_FUNNEL = [
  { step: 'Quote started', n: 1240 },
  { step: 'AI scan complete', n: 928 },
  { step: 'Documents added', n: 671 },
  { step: 'Estimate viewed', n: 604 },
  { step: 'Signed & submitted', n: 388 },
  { step: 'Prepaid · booked', n: 311 },
];

const PH_EVENTS = [
  { ev: 'quote_submitted', who: 'klajdi.h@…', time: '2m', props: 'Lisbon · LCL · $1,320' },
  { ev: 'ai_scan_completed', who: 'd.owusu@…', time: '6m', props: 'car · 12 m³ · 99% conf' },
  { ev: 'payment_authorized', who: 'a.marchetti@…', time: '14m', props: '$1,850 · card' },
  { ev: 'loading_photos_viewed', who: 'tomas.v@…', time: '21m', props: 'VMR-48201 · 18 photos' },
  { ev: 'support_chat_opened', who: 'priya.r@…', time: '38m', props: 'VMR-48155' },
  { ev: 'quote_abandoned', who: 'anon · web', time: '47m', props: 'step: documents' },
];

const PH_TREND = [62, 71, 58, 80, 74, 91, 88, 97, 84, 102, 96, 311 / 3];

Object.assign(window, { OPS_QUOTES, OPS_STAGES, OPS_PIPELINE, OPS_THREADS, OPS_KPIS, PH_FUNNEL, PH_EVENTS, PH_TREND });
