// Seed data for DARA 2.0 Tenant Admin prototype

const AVATAR_COLORS = [
  ["oklch(65% 0.13 220)", "oklch(45% 0.13 220)"],
  ["oklch(65% 0.13 155)", "oklch(45% 0.13 155)"],
  ["oklch(68% 0.14 75)",  "oklch(48% 0.14 75)"],
  ["oklch(62% 0.17 295)", "oklch(42% 0.17 295)"],
  ["oklch(62% 0.17 22)",  "oklch(42% 0.17 22)"],
  ["oklch(65% 0.13 260)", "oklch(45% 0.13 260)"],
  ["oklch(65% 0.13 185)", "oklch(45% 0.13 185)"],
  ["oklch(65% 0.13 40)",  "oklch(45% 0.13 40)"],
];

function hashInt(s) {
  let h = 0;
  for (let i = 0; i < s.length; i++) h = (h * 31 + s.charCodeAt(i)) | 0;
  return Math.abs(h);
}

function Avatar({ name, size = "md" }) {
  const initials = name.split(" ").map(w => w[0]).slice(0, 2).join("").toUpperCase();
  const [c1, c2] = AVATAR_COLORS[hashInt(name) % AVATAR_COLORS.length];
  const cls = "avatar" + (size === "sm" ? " sm" : size === "lg" ? " lg" : "");
  return (
    <div className={cls} style={{ background: `linear-gradient(135deg, ${c1}, ${c2})` }}>
      {initials}
    </div>
  );
}

const VISITORS = [
  { id: "V-10491", name: "Amira Haddad",     company: "Lumen Capital",     host: "Yara Al-Otaibi",    hostTeam: "Strategy",     purpose: "Investor briefing",       type: "standard", status: "onsite",    arrival: "09:12", scheduled: "09:00", dest: "Boardroom A · Tower 1 · L14", badge: "B-2041", checkout: "—" },
  { id: "V-10492", name: "Marcus Chen",      company: "Helix Robotics",    host: "Omar Rahman",       hostTeam: "Engineering",  purpose: "Hardware demo",          type: "vip",      status: "onsite",    arrival: "09:28", scheduled: "09:30", dest: "Innovation Lab · Tower 2 · L3", badge: "B-2042", checkout: "—" },
  { id: "V-10493", name: "Sofia Navarro",    company: "Ember Studios",     host: "Leila Khoury",      hostTeam: "Brand",        purpose: "Creative review",        type: "standard", status: "pending",   arrival: "—",     scheduled: "10:00", dest: "Studio 4 · Tower 1 · L2",       badge: "—",      checkout: "—" },
  { id: "V-10494", name: "Daniel Park",      company: "Northfield Legal",  host: "Hana Yusuf",        hostTeam: "Legal",        purpose: "Contract signing",       type: "standard", status: "approved",  arrival: "—",     scheduled: "10:30", dest: "Meeting 3A · Tower 1 · L9",     badge: "—",      checkout: "—" },
  { id: "V-10495", name: "Priya Iyer",       company: "Kestrel Analytics", host: "Nadim Saleh",       hostTeam: "Data",         purpose: "Quarterly review",       type: "standard", status: "onsite",    arrival: "09:45", scheduled: "09:45", dest: "Data Studio · Tower 2 · L5",    badge: "B-2043", checkout: "—" },
  { id: "V-10496", name: "Johan Lindqvist",  company: "Arlo Industrial",   host: "Yara Al-Otaibi",    hostTeam: "Strategy",     purpose: "Facility tour",          type: "vip",      status: "approved",  arrival: "—",     scheduled: "11:00", dest: "Executive Lounge · Tower 1 · L15", badge: "—",   checkout: "—" },
  { id: "V-10497", name: "Rania Boudiaf",    company: "Mirage Ventures",   host: "Faisal Qureshi",    hostTeam: "Corp Dev",     purpose: "Due diligence",          type: "standard", status: "checkedout", arrival: "08:05", scheduled: "08:00", dest: "Boardroom B · Tower 1 · L14",   badge: "—",      checkout: "09:18" },
  { id: "V-10498", name: "Arjun Menon",      company: "Solace Health",     host: "Mariam Nasser",     hostTeam: "Partnerships", purpose: "Partnership intro",      type: "standard", status: "pending",   arrival: "—",     scheduled: "11:30", dest: "Huddle 2 · Tower 1 · L6",       badge: "—",      checkout: "—" },
  { id: "V-10499", name: "Elena Ruiz",       company: "Vantage Media",     host: "Leila Khoury",      hostTeam: "Brand",        purpose: "Content workshop",       type: "standard", status: "denied",    arrival: "—",     scheduled: "14:00", dest: "Studio 4 · Tower 1 · L2",       badge: "—",      checkout: "—" },
  { id: "V-10500", name: "Tom Whitaker",     company: "Bluegrass AV",      host: "Omar Rahman",       hostTeam: "Engineering",  purpose: "Vendor service",         type: "standard", status: "onsite",    arrival: "09:04", scheduled: "09:00", dest: "Broadcast Room · Tower 2 · L1", badge: "B-2044", checkout: "—" },
  { id: "V-10501", name: "Yuki Tanaka",      company: "Coastal Robotics",  host: "Omar Rahman",       hostTeam: "Engineering",  purpose: "Integration test",       type: "standard", status: "approved",  arrival: "—",     scheduled: "13:00", dest: "Innovation Lab · Tower 2 · L3", badge: "—",      checkout: "—" },
  { id: "V-10502", name: "Hassan Al-Sabah",  company: "Gulf Holdings",     host: "Yara Al-Otaibi",    hostTeam: "Strategy",     purpose: "Board preparation",      type: "vip",      status: "onsite",    arrival: "08:40", scheduled: "09:00", dest: "Executive Lounge · Tower 1 · L15", badge: "B-2045", checkout: "—" },
];

const APPROVALS = [
  { id: "A-881", visitor: "Sofia Navarro",  company: "Ember Studios",    purpose: "Creative review",     host: "Leila Khoury", stage: "Security review",  level: "2 of 3", requested: "12m ago", sla: "18m", risk: "low" },
  { id: "A-880", visitor: "Arjun Menon",    company: "Solace Health",    purpose: "Partnership intro",   host: "Mariam Nasser", stage: "Host confirmation", level: "1 of 2", requested: "26m ago", sla: "34m", risk: "low" },
  { id: "A-879", visitor: "Marcus Chen",    company: "Helix Robotics",   purpose: "Hardware demo",       host: "Omar Rahman",  stage: "Legal NDA",         level: "3 of 3", requested: "1h ago",  sla: "overdue 4m", risk: "med" },
  { id: "A-878", visitor: "Elena Ruiz",     company: "Vantage Media",    purpose: "Content workshop",    host: "Leila Khoury", stage: "Watchlist flagged", level: "—",      requested: "2h ago",  sla: "—",    risk: "high" },
  { id: "A-877", visitor: "Yuki Tanaka",    company: "Coastal Robotics", purpose: "Integration test",    host: "Omar Rahman",  stage: "Compliance docs",   level: "1 of 2", requested: "3h ago",  sla: "2h 11m", risk: "low" },
  { id: "A-876", visitor: "Johan Lindqvist",company: "Arlo Industrial",  purpose: "Facility tour",       host: "Yara Al-Otaibi", stage: "VIP fast-track",  level: "—",      requested: "3h ago",  sla: "bypass", risk: "low" },
];

// 24h visitor volume in 30-min buckets
const VOLUME_24H = [
  0,0,0,0,0,0,0,1,0,0,1,2,4,8,14,22,26,19,15,11,8,6,4,3,2,2,1,3,4,6,9,12,14,11,8,5,3,2,1,1,0,0,0,0,0,0,0,0
];

const TENANTS_SUMMARY = [
  { name: "AXS Holdings HQ", sites: 4, visitorsToday: 312, status: "healthy" },
  { name: "Beacon Tower West", sites: 1, visitorsToday: 98, status: "healthy" },
  { name: "Meridian Logistics", sites: 7, visitorsToday: 54, status: "attention" },
  { name: "Ridgeway Financial", sites: 2, visitorsToday: 181, status: "healthy" },
];

const INTEGRATIONS = [
  { name: "Lenel OnGuard", category: "Access Control", status: "connected", events: "12.4k / day", last: "2s ago" },
  { name: "Microsoft 365",  category: "Calendar",       status: "connected", events: "3.1k / day",  last: "12s ago" },
  { name: "Slack",          category: "Notifications",  status: "connected", events: "890 / day",   last: "45s ago" },
  { name: "Appspace",       category: "Digital Signage",status: "connected", events: "2.2k / day",  last: "1m ago" },
  { name: "ServiceNow",     category: "ITSM",           status: "warning",   events: "120 / day",   last: "14m ago" },
  { name: "Okta",           category: "Identity",       status: "connected", events: "—",           last: "—" },
  { name: "HID Mercury",    category: "Access Control", status: "disabled",  events: "—",           last: "—" },
  { name: "Salto KS",       category: "Locks",          status: "connected", events: "610 / day",   last: "3m ago" },
];

const ACTIVITY = [
  { t: "09:47", who: "Marcus Chen",       what: "checked in at", where: "Lobby A · Tower 2", by: "Guard Khalid M.", type: "checkin" },
  { t: "09:45", who: "Priya Iyer",        what: "checked in at", where: "Lobby A · Tower 2", by: "Guard Khalid M.", type: "checkin" },
  { t: "09:43", who: "Sofia Navarro",     what: "awaiting",      where: "Security review (2/3)", by: "Workflow: Standard", type: "approval" },
  { t: "09:41", who: "Hassan Al-Sabah",   what: "VIP fast-track arrival at", where: "Executive Entrance", by: "Host escort assigned", type: "vip" },
  { t: "09:35", who: "Tom Whitaker",      what: "checked in at", where: "Lobby B · Tower 1", by: "QR self-service", type: "checkin" },
  { t: "09:28", who: "Elena Ruiz",        what: "denied —",      where: "Watchlist match", by: "Security Admin", type: "denied" },
  { t: "09:20", who: "Rania Boudiaf",     what: "checked out at",where: "Lobby A · Tower 1", by: "Auto-checkout", type: "checkout" },
  { t: "09:12", who: "Amira Haddad",      what: "checked in at", where: "Lobby A · Tower 1", by: "Guard Samir F.", type: "checkin" },
];

const ACCENT_PRESETS = [
  { name: "Teal",    h: 198, c: 0.12 },
  { name: "Cobalt",  h: 220, c: 0.13 },
  { name: "Violet",  h: 275, c: 0.13 },
  { name: "Emerald", h: 155, c: 0.12 },
  { name: "Amber",   h: 70,  c: 0.14 },
  { name: "Graphite",h: 240, c: 0.02 },
];

Object.assign(window, { VISITORS, APPROVALS, VOLUME_24H, TENANTS_SUMMARY, INTEGRATIONS, ACTIVITY, ACCENT_PRESETS, Avatar, AVATAR_COLORS, hashInt });
