/* ============================================================================
   MOWDEW — Mock data
   A small, coherent world: provider Diego Marta (Marta Lawn & Pool, Bay Area),
   his route of homes, the visits that actually happened, and the invoices /
   payments that flow from them. Homeowner POV = Emma Walsh @ 88 Crestline Ave.
   ========================================================================= */

const TODAY = 'Tue, May 12';

// Service types -> icon + color + default price (cents)
const SERVICE = {
  mow:   { label: 'Mow & edge',   icon: 'leaf',    tone: 'green', price: 5500, scene: 'lawn' },
  pool:  { label: 'Pool service', icon: 'droplet', tone: 'blue',  price: 6500, scene: 'pool' },
  blow:  { label: 'Mow & blow',   icon: 'leaf',    tone: 'green', price: 4800, scene: 'lawn' },
  hedge: { label: 'Hedge & beds', icon: 'can',     tone: 'yellow', price: 9000, scene: 'hedge' },
};

// Homes on Diego's route today
const HOMES = [
  { id: 'h1', who: 'The Mirandas', name: 'Lucia Miranda', addr: '14 Oak Ridge Ct', city: 'Palo Alto', svc: 'mow', cadence: 'Every 2 weeks',
    status: 'done', in: '9:06 AM', out: '9:41 AM', dur: '35 min', eta: null, geo: true,
    visits: [ {date:'May 12', dur:'35 min', who:'Diego'}, {date:'Apr 28', dur:'38 min', who:'Diego'}, {date:'Apr 14', dur:'33 min', who:'Diego'} ] },
  { id: 'h2', who: 'Emma Walsh', name: 'Emma Walsh', addr: '88 Crestline Ave', city: 'Menlo Park', svc: 'pool', cadence: 'Weekly',
    status: 'onsite', in: '10:12 AM', out: null, dur: null, eta: null, geo: true,
    visits: [ {date:'May 12', dur:'—', who:'Diego'}, {date:'May 5', dur:'24 min', who:'Diego'}, {date:'Apr 28', dur:'27 min', who:'Diego'}, {date:'Apr 21', dur:'22 min', who:'Diego'} ] },
  { id: 'h3', who: 'The Okonkwos', name: 'Ada Okonkwo', addr: '3 Brookhaven Ln', city: 'Menlo Park', svc: 'blow', cadence: 'Weekly',
    status: 'upcoming', in: null, out: null, dur: null, eta: '11:15 AM', geo: true,
    visits: [ {date:'May 5', dur:'29 min', who:'Diego'}, {date:'Apr 28', dur:'31 min', who:'Diego'} ] },
  { id: 'h4', who: 'Sandra Lemoine', name: 'Sandra Lemoine', addr: '27 Alameda Pl', city: 'Atherton', svc: 'hedge', cadence: 'Monthly',
    status: 'upcoming', in: null, out: null, dur: null, eta: '12:30 PM', geo: true,
    visits: [ {date:'Apr 12', dur:'1h 05m', who:'Diego'} ] },
  { id: 'h5', who: 'The Bauers', name: 'Tom Bauer', addr: '5 Marin Vista', city: 'Atherton', svc: 'pool', cadence: 'Weekly',
    status: 'upcoming', in: null, out: null, dur: null, eta: '1:20 PM', geo: false,
    visits: [ {date:'May 5', dur:'26 min', who:'Diego'} ] },
];

// Homeowner (Emma) — her verified visit feed for 88 Crestline Ave
const FEED = [
  { id: 'v1', date: 'Today · May 12', svc: 'pool', in: '10:12 AM', out: null, dur: 'On-site now', verified: true, live: true,
    note: 'Skimming and chemical balance in progress.' },
  { id: 'v2', date: 'Mon · May 5', svc: 'pool', in: '10:04 AM', out: '10:28 AM', dur: '24 min', verified: true,
    note: 'Backwashed filter, added chlorine. Water clear, pH 7.4.' },
  { id: 'v3', date: 'Mon · Apr 28', svc: 'pool', in: '9:58 AM', out: '10:25 AM', dur: '27 min', verified: true,
    note: 'Vacuumed pool, emptied skimmer baskets. Noted low chlorine — corrected.' },
  { id: 'v4', date: 'Mon · Apr 21', svc: 'pool', in: '10:20 AM', out: '10:42 AM', dur: '22 min', verified: true,
    note: 'Routine service. Everything looking great heading into summer.' },
];

// Invoices (provider builds; homeowner receives)
const INVOICES = [
  { id: 'INV-0007', month: 'May 2026', from: 'Diego Marta', biz: 'Marta Lawn & Pool', to: 'Emma Walsh', addr: '88 Crestline Ave',
    status: 'unpaid', total: 26000, issued: 'May 12', due: 'May 26',
    lines: [
      { date: 'May 12', label: 'Pool service', verified: true, cents: 6500 },
      { date: 'May 5',  label: 'Pool service', verified: true, cents: 6500 },
      { date: 'Apr 28', label: 'Pool service', verified: true, cents: 6500 },
      { date: 'Apr 21', label: 'Pool service', verified: true, cents: 6500 },
    ] },
];

// Payment ledger (homeowner) — never pay twice
const LEDGER = [
  { id: 'l1', month: 'May 2026', visits: 4, cents: 26000, status: 'unpaid', invoice: 'INV-0007' },
  { id: 'l2', month: 'Apr 2026', visits: 4, cents: 26000, status: 'paid', rail: 'zelle', paidOn: 'Apr 30', invoice: 'INV-0006' },
  { id: 'l3', month: 'Mar 2026', visits: 5, cents: 32500, status: 'paid', rail: 'venmo', paidOn: 'Mar 28', invoice: 'INV-0005' },
  { id: 'l4', month: 'Feb 2026', visits: 4, cents: 26000, status: 'paid', rail: 'zelle', paidOn: 'Feb 26', invoice: 'INV-0004' },
  { id: 'l5', month: 'Jan 2026', visits: 4, cents: 26000, status: 'paid', rail: 'paypal', paidOn: 'Jan 29', invoice: 'INV-0003' },
];

const PROVIDER = { name: 'Diego Marta', biz: 'Marta Lawn & Pool', rails: ['zelle', 'venmo', 'paypal'], zelle: 'diego@martalawn.co', venmo: '@diego-marta', region: 'Bay Area' };
const HOMEOWNER = { name: 'Emma Walsh', addr: '88 Crestline Ave', city: 'Menlo Park' };

Object.assign(window, { TODAY, SERVICE, HOMES, FEED, INVOICES, LEDGER, PROVIDER, HOMEOWNER });
