// Seed data for Dashy prototype

const SEED_TASKS = [
  // Lani
  { id: 't1', title: 'Call back Mrs. Patel re: Hilux service quote',
    description: 'She left a voicemail Tuesday — wants confirmation on the timing belt price before she books in.',
    assignee: 'lani', addedBy: 'rod', priority: 'high', source: 'imessage',
    addedAt: '2026-05-08T08:42:00', status: 'open',
    tags: ['quote'] },
  { id: 't2', title: 'Email #3814 → Workorder #2207',
    description: 'Auto-converted from inbox. Tell customer ETA of Friday.',
    assignee: 'lani', addedBy: 'system', priority: 'med', source: 'email',
    addedAt: '2026-05-08T07:15:00', status: 'open',
    tags: ['WO #2207'] },
  { id: 't3', title: 'Reorder coolant — 5L × 4',
    description: 'Stock card ran red on the morning sweep.',
    assignee: 'lani', addedBy: 'kirra', priority: 'low', source: 'manual',
    addedAt: '2026-05-07T16:02:00', status: 'open' },
  { id: 't4', title: 'Form response from "K. Wynne" auto-switched to Billing',
    description: 'Originally captured as Service Booking — heads up.',
    assignee: 'lani', addedBy: 'system', priority: 'med', source: 'automation',
    addedAt: '2026-05-08T09:50:00', status: 'billing',
    tags: ['form'] },

  // Kirra
  { id: 't5', title: 'Diagnose intermittent misfire — Camry, WO #2199',
    description: 'Cust says it stutters between 60–80km/h once warm.',
    assignee: 'kirra', addedBy: 'rod', priority: 'high', source: 'manual',
    addedAt: '2026-05-08T07:50:00', status: 'open',
    tags: ['WO #2199'] },
  { id: 't6', title: 'Sign off on Ayron\'s brake job — Forester',
    description: 'Final torque check + road test before pickup at 3pm.',
    assignee: 'kirra', addedBy: 'ayron', priority: 'med', source: 'manual',
    addedAt: '2026-05-08T09:05:00', status: 'open' },
  { id: 't7', title: 'WO #2188 auto-marked Unsuccessful',
    description: 'Customer no-show twice — please review and decide on next step.',
    assignee: 'kirra', addedBy: 'system', priority: 'high', source: 'automation',
    addedAt: '2026-05-08T06:00:00', status: 'unsuccessful',
    tags: ['WO #2188'] },

  // Ayron
  { id: 't8', title: 'Replace front pads + rotors — Forester',
    description: 'Parts arrived yesterday. Bay 2 from 10am.',
    assignee: 'ayron', addedBy: 'kirra', priority: 'med', source: 'manual',
    addedAt: '2026-05-08T08:00:00', status: 'open',
    tags: ['WO #2201'] },
  { id: 't9', title: 'Tidy bay 3 + sweep before lunch',
    description: '',
    assignee: 'ayron', addedBy: 'rod', priority: 'low', source: 'imessage',
    addedAt: '2026-05-08T09:30:00', status: 'open' },
  { id: 't10', title: 'Pickup parts from Repco @ 11:30',
    description: 'Two boxes for WO #2199 + an oil filter for stock.',
    assignee: 'ayron', addedBy: 'lani', priority: 'med', source: 'manual',
    addedAt: '2026-05-08T08:20:00', status: 'open' },

  // ROD
  { id: 't11', title: 'Approve quote on Job #2207 ($1,840)',
    description: 'Lani flagged this — needs your sign-off before sending.',
    assignee: 'rod', addedBy: 'lani', priority: 'high', source: 'manual',
    addedAt: '2026-05-08T09:12:00', status: 'open',
    tags: ['quote', 'WO #2207'] },
  { id: 't12', title: 'Review weekly automation report',
    description: '14 tasks created from email, 6 from iMessage, 2 form re-routes.',
    assignee: 'rod', addedBy: 'system', priority: 'low', source: 'automation',
    addedAt: '2026-05-08T06:00:00', status: 'open' },
];

const SEED_AUDIT = [
  { id: 'a1', at: '2026-05-08T09:50:00', actor: 'system', action: 'form_rerouted',
    summary: 'Form from K. Wynne auto-switched: Service Booking → Billing form',
    target: 't4' },
  { id: 'a2', at: '2026-05-08T09:30:00', actor: 'rod', action: 'task_created',
    summary: 'Created task "Tidy bay 3 + sweep before lunch" for Ayron via iMessage',
    target: 't9' },
  { id: 'a3', at: '2026-05-08T09:12:00', actor: 'lani', action: 'task_assigned',
    summary: 'Assigned "Approve quote on Job #2207" to ROD',
    target: 't11' },
  { id: 'a4', at: '2026-05-08T09:05:00', actor: 'ayron', action: 'task_moved',
    summary: 'Moved "Sign off on brake job" from Ayron → Kirra',
    target: 't6' },
  { id: 'a5', at: '2026-05-08T08:42:00', actor: 'rod', action: 'task_created',
    summary: 'Created task "Call back Mrs. Patel" for Lani via iMessage',
    target: 't1' },
  { id: 'a6', at: '2026-05-08T08:20:00', actor: 'lani', action: 'task_created',
    summary: 'Created task "Pickup parts from Repco" for Ayron',
    target: 't10' },
  { id: 'a7', at: '2026-05-08T08:00:00', actor: 'kirra', action: 'task_created',
    summary: 'Created task "Replace front pads + rotors" for Ayron',
    target: 't8' },
  { id: 'a8', at: '2026-05-08T07:50:00', actor: 'rod', action: 'task_edited',
    summary: 'Edited priority on "Diagnose intermittent misfire" — Med → High',
    target: 't5' },
  { id: 'a9', at: '2026-05-08T07:15:00', actor: 'system', action: 'email_converted',
    summary: 'Email #3814 converted to Workorder #2207 (assigned to Lani)',
    target: 't2' },
  { id: 'a10', at: '2026-05-08T06:00:00', actor: 'system', action: 'task_unsuccessful',
    summary: 'WO #2188 auto-marked Unsuccessful after 2 missed bookings',
    target: 't7' },
  { id: 'a11', at: '2026-05-07T16:02:00', actor: 'kirra', action: 'task_created',
    summary: 'Created task "Reorder coolant" for Lani',
    target: 't3' },
  { id: 'a12', at: '2026-05-07T15:30:00', actor: 'rod', action: 'login',
    summary: 'Signed in from MacBook · Christchurch',
    target: null },
];

// Per-task audit slices
const TASK_AUDIT = {
  t1: [
    { at: '2026-05-08T08:42:00', actor: 'rod',  action: 'created via iMessage',
      detail: '"Hey, create new task for Lani — call back Mrs. Patel about the Hilux quote, she wants confirmation before she books"' },
    { at: '2026-05-08T08:43:00', actor: 'system', action: 'priority set to High', detail: 'Inferred from "wants confirmation"' },
    { at: '2026-05-08T08:45:00', actor: 'lani', action: 'opened',  detail: '' },
  ],
  t11: [
    { at: '2026-05-08T09:12:00', actor: 'lani', action: 'assigned to ROD', detail: 'flagged for sign-off before send' },
    { at: '2026-05-08T09:14:00', actor: 'lani', action: 'added note', detail: 'Customer wants the work done before Mother\'s Day weekend.' },
  ],
};

window.SEED_TASKS = SEED_TASKS;
window.SEED_AUDIT = SEED_AUDIT;
window.TASK_AUDIT = TASK_AUDIT;
