// ── Oasis HMS · Mock data (content lifted from the Figma frames) ─────────────

// Department meta: icon + brand color
const DEPARTMENTS = {
  Housekeeping: { icon: "droplet",   color: "#4A90E2" },
  Security:     { icon: "shield",    color: "#4A90E2" },
  Maintenance:  { icon: "wrench",    color: "#4A90E2" },
  "Front Desk": { icon: "concierge", color: "#4A90E2" },
  Restaurant:   { icon: "utensils",  color: "#4A90E2" },
  Spa:          { icon: "heart",     color: "#4A90E2" },
  Lounge:       { icon: "beer",      color: "#4A90E2" },
};

// Active alerts (dashboard left panel). priority: high | medium | low
const ALERTS = [
  { id: "a1", title: "AC Leak",          where: "Room 105",            time: "10:12", dept: "Maintenance",  priority: "high"   },
  { id: "a2", title: "Cleaning",         where: "Lobby",               time: "09:26", dept: "Housekeeping", priority: "medium" },
  { id: "a3", title: "Elevator is Stuck", where: "Floor 4",            time: "08:30", dept: null,           priority: "medium" },
  { id: "a4", title: "Soap Re-fill",     where: "Restaurant Restroom", time: "13:47", dept: "Housekeeping", priority: "low"    },
  { id: "a5", title: "Electricity Check", where: "Rooftop",            time: "15:27", dept: "Maintenance",  priority: "high"   },
  { id: "a6", title: "Broken Lamp",      where: "Room 224",            time: "11:40", dept: "Maintenance",  priority: "medium" },
  { id: "a7", title: "Towel Request",    where: "Room 318",            time: "12:05", dept: "Housekeeping", priority: "low"    },
  { id: "a8", title: "Mini-bar Restock", where: "Room 401",            time: "07:55", dept: "Front Desk",   priority: "low"    },
  { id: "a9",  title: "Gas Smell",          where: "Main Kitchen",     time: "06:42", dept: "Maintenance",  priority: "high"   },
  { id: "a10", title: "Guest Locked Out",    where: "Room 332",        time: "14:08", dept: "Security",     priority: "high"   },
  { id: "a11", title: "Water Flooding",      where: "Basement Level",  time: "05:30", dept: null,           priority: "high"   },
  { id: "a12", title: "Spa Heater Down",     where: "Spa",             time: "10:50", dept: "Spa",          priority: "medium" },
  { id: "a13", title: "Noise Complaint",     where: "Room 210",        time: "23:14", dept: "Security",     priority: "medium" },
  { id: "a14", title: "Late Checkout",       where: "Room 145",        time: "11:20", dept: "Front Desk",   priority: "medium" },
  { id: "a15", title: "Broken Blinds",       where: "Room 277",        time: "09:05", dept: "Maintenance",  priority: "medium" },
  { id: "a16", title: "Extra Towels",        where: "Room 502",        time: "13:02", dept: "Housekeeping", priority: "low"    },
  { id: "a17", title: "Slow Wi-Fi",          where: "Room 388",        time: "16:40", dept: null,           priority: "low"    },
  { id: "a18", title: "Menu Re-print",       where: "Restaurant",      time: "08:15", dept: "Restaurant",   priority: "low"    },
  { id: "a19", title: "Glassware Restock",   where: "Lounge",          time: "17:25", dept: "Lounge",       priority: "low"    },
];

// KPI cards - dashboard top row
const DASH_KPIS = [
  { id: "alerts",  label: "High Priority Alerts", value: 5,  sub: "Require immediate action", cta: "View All Alerts",     icon: "alert-triangle", tone: "red" },
  { id: "checkin", label: "Check-Ins Today",      value: 8,  sub: "Upcoming arrivals",        cta: "View All Check-Ins",  icon: "calendar",       tone: "green" },
  { id: "checkout",label: "Check-Outs Today",     value: 10, sub: "Upcoming Departures",      cta: "View All Check-Outs", icon: "briefcase",      tone: "blue" },
  { id: "special", label: "Special Requests",     value: 8,  sub: "Guests' special requests", cta: "View All Requests",   icon: "star",           tone: "purple" },
];

// Occupancy chart (this week)
const OCCUPANCY = [
  { day: "10 Feb", occ: 30, cap: 42 },
  { day: "11 Feb", occ: 18, cap: 42 },
  { day: "12 Feb", occ: 24, cap: 42 },
  { day: "13 Feb", occ: 38, cap: 42 },
  { day: "14 Feb", occ: 42, cap: 42 },
  { day: "15 Feb", occ: 24, cap: 42 },
  { day: "16 Feb", occ: 11, cap: 42 },
];

// Selectable weeks for the occupancy dropdown (newest first)
const OCCUPANCY_WEEKS = [
  { id: "this", label: "This Week", data: OCCUPANCY },
  { id: "w-1", label: "Last Week", data: [
    { day: "03 Feb", occ: 22, cap: 42 }, { day: "04 Feb", occ: 28, cap: 42 },
    { day: "05 Feb", occ: 31, cap: 42 }, { day: "06 Feb", occ: 19, cap: 42 },
    { day: "07 Feb", occ: 35, cap: 42 }, { day: "08 Feb", occ: 40, cap: 42 },
    { day: "09 Feb", occ: 26, cap: 42 },
  ] },
  { id: "w-2", label: "Jan 20 - Jan 26", data: [
    { day: "20 Jan", occ: 14, cap: 42 }, { day: "21 Jan", occ: 20, cap: 42 },
    { day: "22 Jan", occ: 17, cap: 42 }, { day: "23 Jan", occ: 29, cap: 42 },
    { day: "24 Jan", occ: 33, cap: 42 }, { day: "25 Jan", occ: 38, cap: 42 },
    { day: "26 Jan", occ: 30, cap: 42 },
  ] },
  { id: "w-3", label: "Jan 13 - Jan 19", data: [
    { day: "13 Jan", occ: 9, cap: 42 },  { day: "14 Jan", occ: 16, cap: 42 },
    { day: "15 Jan", occ: 23, cap: 42 }, { day: "16 Jan", occ: 21, cap: 42 },
    { day: "17 Jan", occ: 27, cap: 42 }, { day: "18 Jan", occ: 34, cap: 42 },
    { day: "19 Jan", occ: 25, cap: 42 },
  ] },
];

// Upcoming arrivals table
const ARRIVALS = [
  { id: "#3781", guest: "Mac Demarco",   room: "213", type: "Double", status: "Ready" },
  { id: "#3672", guest: "Matt Berninger", room: "201", type: "Family", status: "In Cleaning" },
  { id: "#3542", guest: "Laura Leezy",    room: "433", type: "Family", status: "Ready" },
  { id: "#3476", guest: "Alex Turner",    room: "505", type: "Suite",  status: "Ready" },
  { id: "#3112", guest: "James Blake",    room: "211", type: "Double", status: "Ready" },
  { id: "#3098", guest: "Clara West",     room: "137", type: "Double", status: "Ready" },
  { id: "#2944", guest: "Omar Haddad",    room: "118", type: "Double", status: "In Cleaning" },
  { id: "#2810", guest: "Nina Powell",    room: "501", type: "Suite",  status: "Ready" },
];

// Staff status bars
const STAFF = [
  { dept: "Housekeeping", on: 8,  total: 8 },
  { dept: "Front Desk",   on: 2,  total: 3 },
  { dept: "Security",     on: 2,  total: 2 },
  { dept: "Maintenance",  on: 2,  total: 2 },
  { dept: "Restaurant",   on: 10, total: 10 },
  { dept: "Spa",          on: 4,  total: 8 },
  { dept: "Lounge",       on: 10, total: 10 },
];

// Quick reservations - venues, dates, and per-venue slot grids
const RES_VENUES = [
  { name: "Restaurant", icon: "utensils" },
  { name: "Lounge",     icon: "beer" },
  { name: "Spa",        icon: "heart" },
];

const RES_DATES = [
  "Today, Feb 16", "Tomorrow, Feb 17", "Wed, Feb 18", "Thu, Feb 19",
  "Fri, Feb 20", "Sat, Feb 21", "Sun, Feb 22",
];

const RES_GUESTS = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10];

// Base slot grid per venue (availability is derived per filter combo below)
const VENUE_SLOTS = {
  Restaurant: {
    Morning:   ["09:00 AM", "09:30 AM", "10:00 AM", "11:00 AM", "11:30 AM"],
    Afternoon: ["12:30 PM", "01:00 PM", "01:30 PM", "02:00 PM", "03:00 PM", "03:30 PM"],
    Evening:   ["06:00 PM", "06:30 PM", "07:00 PM", "08:00 PM", "08:30 PM", "09:00 PM"],
  },
  Lounge: {
    Afternoon: ["02:00 PM", "03:00 PM", "04:00 PM", "05:00 PM"],
    Evening:   ["06:00 PM", "07:00 PM", "08:00 PM", "09:00 PM", "10:00 PM", "11:00 PM"],
  },
  Spa: {
    Morning:   ["08:00 AM", "09:00 AM", "10:00 AM", "11:00 AM"],
    Afternoon: ["12:30 PM", "01:30 PM", "02:30 PM", "03:30 PM", "04:30 PM"],
  },
};

// Legacy alias (kept for any earlier reference)
const SLOTS = VENUE_SLOTS.Restaurant;

// Deterministic availability: same filters → same result, bigger parties → fewer
// free slots, and changing venue/date/guests visibly changes what's open.
function reservationSlots(venueName, dateIdx, guests) {
  const grid = VENUE_SLOTS[venueName] || {};
  const out = {};
  for (const [part, times] of Object.entries(grid)) {
    out[part] = times.map((time) => {
      const key = venueName + "|" + dateIdx + "|" + part + "|" + time;
      let h = 0;
      for (let i = 0; i < key.length; i++) h = (h * 31 + key.charCodeAt(i)) % 1000;
      const score = h % 100;
      return { time, available: score > guests * 6 };
    });
  }
  return out;
}
window.reservationSlots = reservationSlots;

// Rooms grid
const ROOMS = [
  { no: "501", type: "Suite",  status: "Available",   floor: 5, guest: null,           date: "18 February, 2026", dateLabel: "Next Check In" },
  { no: "512", type: "Suite",  status: "Available",   floor: 5, guest: null,           date: "18 February, 2026", dateLabel: "Next Check In" },
  { no: "433", type: "Family", status: "Occupied",    floor: 4, guest: "Emily Jane",   date: "21 February, 2026", dateLabel: "Check Out" },
  { no: "211", type: "Double", status: "In Cleaning", floor: 2, guest: "James Blake",  date: "21 February, 2026", dateLabel: "Check Out" },
  { no: "505", type: "Suite",  status: "Maintenance", floor: 5, guest: "Alex Turner",  date: "24 February, 2026", dateLabel: "Check Out" },
  { no: "361", type: "Family", status: "Maintenance", floor: 3, guest: null,           date: "20 February, 2026", dateLabel: "Next Check In" },
  { no: "412", type: "Family", status: "Occupied",    floor: 4, guest: "Mac Demarco",  date: "21 February, 2026", dateLabel: "Check Out" },
  { no: "226", type: "Double", status: "In Cleaning", floor: 2, guest: null,           date: "16 February, 2026", dateLabel: "Next Check In" },
  { no: "414", type: "Family", status: "Occupied",    floor: 4, guest: "Mac Miller",   date: "22 February, 2026", dateLabel: "Check Out" },
  { no: "502", type: "Suite",  status: "Occupied",    floor: 5, guest: "Leon Bridges", date: "21 February, 2026", dateLabel: "Check Out" },
  { no: "137", type: "Double", status: "Available",   floor: 1, guest: null,           date: "19 February, 2026", dateLabel: "Next Check In" },
  { no: "118", type: "Double", status: "Available",   floor: 1, guest: null,           date: "18 February, 2026", dateLabel: "Next Check In" },
  { no: "352", type: "Family", status: "Occupied",    floor: 3, guest: "Phoebe B.",    date: "23 February, 2026", dateLabel: "Check Out" },
  { no: "521", type: "Suite",  status: "Maintenance", floor: 5, guest: null,           date: "25 February, 2026", dateLabel: "Next Check In" },
  { no: "223", type: "Double", status: "Occupied",    floor: 2, guest: "Sufjan S.",    date: "20 February, 2026", dateLabel: "Check Out" },
];

// Rooms KPI row
const ROOM_KPIS = [
  { id: "maint",  label: "Maintenance Issue", value: 6,  sub: "Require immediate action", icon: "wrench",  tone: "red" },
  { id: "avail",  label: "Available Rooms",   value: 10, sub: "Ready for Check-In",       icon: "bed",     tone: "green" },
  { id: "occ",    label: "Occupied Rooms",    value: 36, sub: "Currently Staying",        icon: "users",   tone: "blue" },
  { id: "clean",  label: "In Cleaning",       value: 12, sub: "Being Cleaned",            icon: "droplet", tone: "amber" },
];

// Room detail (Room 433 → Emily Jane)
const ROOM_DETAIL = {
  guest: {
    name: "Emily Jane", passport: "545123456", phone: "+134598772",
    nationality: "United States of America", dob: "17 May 1992", email: "Emilyj@Gmail.com",
  },
  room: {
    no: "433", status: "Occupied", size: "42 m2", floor: 4, type: "Double",
    maxGuests: "2 Adults, 1 Child", view: "Ocean View", bed: "King Size",
  },
  amenities: [
    { label: "Free Wi-Fi", icon: "wifi" }, { label: "Air Conditioning", icon: "snow" },
    { label: "TV", icon: "tv" }, { label: "Coffee Machine", icon: "coffee" },
    { label: "Safe Box", icon: "safe" }, { label: "Hair Dryer", icon: "dryer" },
    { label: "Room Service", icon: "concierge" }, { label: "Ocean View", icon: "waves" },
    { label: "Bath", icon: "bath" },
  ],
  reservation: {
    bookingId: "#4762", checkIn: "15 February 2026", checkInTime: "02:00 PM",
    checkOut: "18 February 2026", checkOutTime: "11:00 AM", guests: "2 Adults", duration: "3 Nights",
  },
  history: [
    { id: "#BKN235", checkIn: "21 May 2025",   checkOut: "26 May 2025",   duration: "5 Nights", status: "Completed" },
    { id: "#BKN472", checkIn: "01 March 2025", checkOut: "03 March 2025", duration: "2 Nights", status: "Canceled" },
    { id: "#BKN118", checkIn: "11 Jan 2025",   checkOut: "14 Jan 2025",   duration: "3 Nights", status: "Completed" },
  ],
};

// Staff status detail (modal). Roster + next shift per the designed Housekeeping view.
const STAFF_ROSTER = {
  Housekeeping: [
    { name: "Mary Jane", role: "Housekeeping Attendant", alloc: "Floor 1" },
    { name: "James Carter", role: "Housekeeping Attendant", alloc: "Floor 3" },
    { name: "Emily Joe", role: "Room Inspector", alloc: "Floor 5" },
    { name: "Sophia Lee", role: "Laundry Attendant", alloc: "Service Room" },
    { name: "Olivia Brown", role: "Housekeeping Attendant", alloc: "Floor 2" },
    { name: "Ethan Will", role: "Housekeeping Attendant", alloc: "Rooftop" },
    { name: "Ava Davis", role: "Guests Attendant", alloc: "Pool/Spa" },
    { name: "Maria Smith", role: "Guests Attendant", alloc: "Rooftop" },
  ],
};
// Fallback roster pool for departments without an explicit list.
// 30 unique names - each pool-based department takes a distinct, non-overlapping
// slice (see StaffModal), so no staff member appears in more than one department.
const STAFF_POOL = [
  { name: "Noah Reed", alloc: "Lobby" },       { name: "Liam Cole", alloc: "Floor 2" },
  { name: "Zoe Park", alloc: "Floor 4" },      { name: "Ben Hardy", alloc: "Service Room" },
  { name: "Ivy Chen", alloc: "Rooftop" },      { name: "Omar Aziz", alloc: "Lobby" },
  { name: "Lena Ruiz", alloc: "Pool/Spa" },    { name: "Theo Vance", alloc: "Floor 1" },
  { name: "Aria Wells", alloc: "Floor 3" },    { name: "Sam Okoye", alloc: "Floor 5" },
  { name: "Mia Foster", alloc: "Restaurant" }, { name: "Jack Nolan", alloc: "Kitchen" },
  { name: "Nora Bishop", alloc: "Bar" },       { name: "Leo Marsh", alloc: "Restaurant" },
  { name: "Hana Kim", alloc: "Floor 2" },      { name: "Diego Salt", alloc: "Kitchen" },
  { name: "Ruby Shaw", alloc: "Lobby" },       { name: "Felix Ward", alloc: "Rooftop" },
  { name: "Tara Singh", alloc: "Floor 4" },    { name: "Owen Pratt", alloc: "Service Room" },
  { name: "Chloe Dunn", alloc: "Pool/Spa" },   { name: "Marcus Bell", alloc: "Floor 1" },
  { name: "Elena Voss", alloc: "Lounge" },     { name: "Kai Mercer", alloc: "Bar" },
  { name: "Priya Nair", alloc: "Floor 3" },    { name: "Hugo Reyes", alloc: "Lounge" },
  { name: "Sadie Lane", alloc: "Lobby" },      { name: "Victor Ono", alloc: "Floor 5" },
  { name: "Grace Mills", alloc: "Rooftop" },   { name: "Adam Frost", alloc: "Bar" },
  { name: "Ella Crane", alloc: "Lobby" },       { name: "Max Pierce", alloc: "Bar" },
  { name: "Nina Brooks", alloc: "Floor 2" },    { name: "Cole Ramsey", alloc: "Lounge" },
  { name: "Vera Lyne", alloc: "Pool/Spa" },
];
const NEXT_SHIFT = [
  { name: "Liam Taylor", role: "Housekeeping Attendant" },
  { name: "Isabella Li", role: "Room Inspector" },
  { name: "Ricky Will", role: "Laundry Attendant" },
];
// Unique next-shift roster pool (no overlap with on-shift names). Each department
// gets its own non-overlapping slice so next-shift names never repeat.
const NEXT_SHIFT_POOL = [
  { name: "Dylan Pope", role: "Attendant" },   { name: "Mabel Ortiz", role: "Supervisor" },
  { name: "Cory Nash", role: "Inspector" },    { name: "Wade Fox", role: "Attendant" },
  { name: "Lucy Tran", role: "Concierge" },    { name: "Ian Petrov", role: "Attendant" },
  { name: "Rosa Lima", role: "Supervisor" },   { name: "Kurt Adler", role: "Technician" },
  { name: "Nadia Haas", role: "Attendant" },   { name: "Pearl Quinn", role: "Inspector" },
  { name: "Seth Barron", role: "Attendant" },  { name: "Vera Lowe", role: "Supervisor" },
  { name: "Marco Diaz", role: "Attendant" },   { name: "Tina Flynn", role: "Concierge" },
  { name: "Glen Pace", role: "Technician" },   { name: "Ada Reyes", role: "Attendant" },
  { name: "Cole Vance", role: "Inspector" },   { name: "Mona Diaz", role: "Attendant" },
  { name: "Reed Klein", role: "Supervisor" },  { name: "Faye Otto", role: "Attendant" },
  { name: "Hugo Sol", role: "Technician" },    { name: "Bree Hall", role: "Concierge" },
];

const NAV = [
  { id: "dashboard", icon: "grid",           label: "Dashboard" },
  { id: "rooms",     icon: "bed-line",       label: "Rooms" },
  { id: "staff",     icon: "users",          label: "Staff" },
  { id: "maint",     icon: "wrench-line",    label: "Maintenance" },
  { id: "security",  icon: "shield-line",    label: "Security" },
  { id: "calendar",  icon: "calendar-check", label: "Reservations" },
];

Object.assign(window, {
  DEPARTMENTS, ALERTS, DASH_KPIS, OCCUPANCY, OCCUPANCY_WEEKS, ARRIVALS, STAFF, SLOTS,
  RES_VENUES, RES_DATES, RES_GUESTS, VENUE_SLOTS,
  ROOMS, ROOM_KPIS, ROOM_DETAIL, NAV, STAFF_ROSTER, STAFF_POOL, NEXT_SHIFT, NEXT_SHIFT_POOL,
});
