// Hotel Walks — seed data for prototype.
// Real Brooklyn + South Florida hotels; everything else is plausible fiction.

const HOTELS = [
  // Brooklyn
  { id: "WYTHE",   name: "Wythe Hotel",                  area: "Williamsburg, BK",       rate: 412 },
  { id: "1HBB",    name: "1 Hotel Brooklyn Bridge",      area: "Brooklyn Heights, BK",   rate: 645 },
  { id: "WMBG",    name: "The William Vale",             area: "Williamsburg, BK",       rate: 528 },
  { id: "ACEBK",   name: "Ace Hotel Brooklyn",           area: "Downtown Brooklyn",      rate: 389 },
  { id: "PNHST",   name: "The Penny Williamsburg",       area: "Williamsburg, BK",       rate: 355 },
  { id: "HOXBK",   name: "The Hoxton, Williamsburg",     area: "Williamsburg, BK",       rate: 372 },
  { id: "TILRY",   name: "The Tillary Hotel Brooklyn",   area: "Downtown Brooklyn",      rate: 268 },
  // South Florida
  { id: "EDRC",    name: "Eden Roc Miami Beach",         area: "Mid-Beach, Miami",       rate: 489 },
  { id: "FBLBL",   name: "Fontainebleau Miami Beach",    area: "Mid-Beach, Miami",       rate: 612 },
  { id: "SETAI",   name: "The Setai, Miami Beach",       area: "South Beach, Miami",     rate: 1140 },
  { id: "FAENA",   name: "Faena Hotel Miami Beach",      area: "Mid-Beach, Miami",       rate: 925 },
  { id: "MNDRN",   name: "Mandarin Oriental, Miami",     area: "Brickell, Miami",        rate: 695 },
  { id: "1SOBE",   name: "1 Hotel South Beach",          area: "South Beach, Miami",     rate: 765 },
  { id: "DELANO",  name: "Delano South Beach",           area: "South Beach, Miami",     rate: 540 },
];

const HOTEL_BY_ID = Object.fromEntries(HOTELS.map(h => [h.id, h]));

// The active property — "me" is the front-desk operator at Wythe Hotel.
const ME = {
  property: HOTEL_BY_ID["WYTHE"],
  user: { name: "Asha Hartwell", role: "Property User", initials: "AH", shift: "PM" },
  timezone: "America/New_York",
};

// Today's outbound walks (rooms I sent out)
const SENT = [
  {
    id: "W-77412",
    serial: "260521-K-WYTHE-1HBB-0027841",
    guest: { name: "Maya Klein", confirmation: "WY-882103", party: 2, nights: 1, arrival: "2026-05-21" },
    to: HOTEL_BY_ID["1HBB"],
    rate: 645, rateOffered: 412,
    status: "letter_sent",
    sentAt: "3:42 pm",
  },
  {
    id: "W-77413",
    serial: "260521-P-WYTHE-HOXBK-0027842",
    guest: { name: "Daniel Park", confirmation: "WY-882118", party: 1, nights: 2, arrival: "2026-05-21" },
    to: HOTEL_BY_ID["HOXBK"],
    rate: 372, rateOffered: 412,
    status: "accepted",
    sentAt: "4:08 pm",
  },
  {
    id: "W-77414",
    serial: null,
    guest: { name: "Ifeoma Okonkwo", confirmation: "WY-882126", party: 2, nights: 1, arrival: "2026-05-21" },
    to: null,
    rate: null, rateOffered: 425,
    status: "broadcasting",
    sentAt: "4:51 pm",
    broadcastTo: ["HOXBK", "PNHST", "WMBG"],
    timer: 18, // minutes remaining at top partner
  },
];

// Incoming opportunities (rooms others are trying to send me)
const INCOMING = [
  {
    id: "OP-9921",
    from: HOTEL_BY_ID["1HBB"],
    rooms: 3,
    when: "Today",
    arrival: "2026-05-21",
    nights: 1,
    targetRate: 420,
    myRate: 412,
    notes: "Family + 2 corporate. Late arrival, ETA 10pm.",
    expiresIn: 27, // minutes
    urgent: false,
  },
  {
    id: "OP-9922",
    from: HOTEL_BY_ID["FBLBL"],
    rooms: 1,
    when: "On May 23",
    arrival: "2026-05-23",
    nights: 2,
    targetRate: null,
    myRate: 412,
    notes: "Single guest, no special requests.",
    expiresIn: 64,
    urgent: false,
  },
  {
    id: "OP-9923",
    from: HOTEL_BY_ID["ACEBK"],
    rooms: 2,
    when: "Today",
    arrival: "2026-05-21",
    nights: 1,
    targetRate: 350,
    myRate: 412,
    notes: "Sold out for the night.",
    expiresIn: 4,
    urgent: true,
  },
];

// Partner list with preferred order (for sending screen)
const PARTNERS = [
  { id: "1HBB",   pref: 1, lastRate: 645, acceptance: 0.82, avgMin: 6  },
  { id: "HOXBK",  pref: 2, lastRate: 372, acceptance: 0.74, avgMin: 11 },
  { id: "PNHST",  pref: 3, lastRate: 355, acceptance: 0.69, avgMin: 8  },
  { id: "WMBG",   pref: 4, lastRate: 528, acceptance: 0.63, avgMin: 14 },
  { id: "ACEBK",  pref: 5, lastRate: 389, acceptance: 0.71, avgMin: 9  },
  { id: "TILRY",  pref: 6, lastRate: 268, acceptance: 0.88, avgMin: 4  },
];

// Invoice ledger — current period
const INVOICE_PERIOD = { label: "May 1 – May 21, 2026", id: "2026-05A" };
const INVOICE_ROWS = [
  // Outbound (we are sending) — $4 + 10% of negotiated rate
  { id: "INV-100231", date: "May 19", side: "Listing",  guest: "M. Klein",       serial: "260519-K-WYTHE-1HBB-0027810",  to: "1HBB",   rate: 645, fee: 4, commission: 64.50, noShow: null,  status: "open"   },
  { id: "INV-100232", date: "May 19", side: "Listing",  guest: "D. Park",        serial: "260519-P-WYTHE-HOXBK-0027811", to: "HOXBK",  rate: 372, fee: 4, commission: 37.20, noShow: null,  status: "open"   },
  { id: "INV-100233", date: "May 18", side: "Listing",  guest: "S. Vega",        serial: "260518-V-WYTHE-PNHST-0027798", to: "PNHST",  rate: 355, fee: 4, commission: 35.50, noShow: null,  status: "paid"  },
  { id: "INV-100234", date: "May 17", side: "Listing",  guest: "J. Ahmadi",      serial: "260517-A-WYTHE-WMBG-0027780",  to: "WMBG",   rate: 528, fee: 4, commission: 52.80, noShow: null,  status: "paid"  },
  // Inbound (we received) — no-show toggle visible
  { id: "INV-100235", date: "May 20", side: "Accepts",  guest: "R. Tanaka",      serial: "260520-T-1HBB-WYTHE-0027819",  from: "1HBB", rate: 412, fee: 4, commission: 41.20, noShow: false, status: "open"  },
  { id: "INV-100236", date: "May 19", side: "Accepts",  guest: "L. Okafor",      serial: "260519-O-ACEBK-WYTHE-0027805", from: "ACEBK",rate: 412, fee: 4, commission: 41.20, noShow: false, status: "open"  },
  { id: "INV-100237", date: "May 18", side: "Accepts",  guest: "F. Greco",       serial: "260518-G-HOXBK-WYTHE-0027792", from: "HOXBK",rate: 412, fee: 4, commission: 41.20, noShow: true,  status: "open"  },
  { id: "INV-100238", date: "May 16", side: "Accepts",  guest: "A. Bauer",       serial: "260516-B-1HBB-WYTHE-0027765",  from: "1HBB", rate: 412, fee: 4, commission: 41.20, noShow: false, status: "paid"  },
];

window.HW_DATA = {
  HOTELS, HOTEL_BY_ID, ME, SENT, INCOMING, PARTNERS, INVOICE_PERIOD, INVOICE_ROWS,
};
