// PortalTable Dashboard — mock agency data. Pure data, assigned to window.

const PD_CLIENT_COLORS = ["#0E9888", "#2D6FE0", "#B5790B", "#15935E", "#7C5CE0", "#C8443B", "#0891B2", "#D9488B"];

const PD_CLIENTS = [
  { id: "c1", name: "Northwind Studio", contact: "Maya Okonkwo", email: "maya@northwind.co", portal: "live", plan: "Scale", projects: 4, mrr: 1450, lastActive: "2h ago", lastActiveTs: 2, health: 96, base: "Marketing Ops" },
  { id: "c2", name: "Halcyon Health", contact: "Devin Park", email: "devin@halcyon.io", portal: "live", plan: "Scale", projects: 3, mrr: 1450, lastActive: "5h ago", lastActiveTs: 5, health: 88, base: "Patient Intake" },
  { id: "c3", name: "Tidewater Co.", contact: "Lena Brooks", email: "lena@tidewater.com", portal: "live", plan: "Growth", projects: 2, mrr: 650, lastActive: "1d ago", lastActiveTs: 24, health: 74, base: "Content Calendar" },
  { id: "c4", name: "Birchwood Realty", contact: "Sam Hale", email: "sam@birchwood.com", portal: "draft", plan: "Growth", projects: 1, mrr: 650, lastActive: "3d ago", lastActiveTs: 72, health: 52, base: "Listings CRM" },
  { id: "c5", name: "Orbit Logistics", contact: "Priya Nair", email: "priya@orbit.dev", portal: "live", plan: "Scale", projects: 5, mrr: 1450, lastActive: "32m ago", lastActiveTs: 0.5, health: 91, base: "Fleet Tracker" },
  { id: "c6", name: "Marigold Events", contact: "Tomas Reyes", email: "tomas@marigold.events", portal: "live", plan: "Growth", projects: 2, mrr: 650, lastActive: "6h ago", lastActiveTs: 6, health: 83, base: "Event Pipeline" },
  { id: "c7", name: "Cedar & Co.", contact: "Aisha Bello", email: "aisha@cedar.co", portal: "paused", plan: "Growth", projects: 1, mrr: 0, lastActive: "9d ago", lastActiveTs: 216, health: 38, base: "Inventory" },
  { id: "c8", name: "Northstar Media", contact: "Jonah Klein", email: "jonah@northstar.tv", portal: "live", plan: "Scale", projects: 3, mrr: 1450, lastActive: "1h ago", lastActiveTs: 1, health: 94, base: "Campaign Hub" },
  { id: "c9", name: "Verdant Farms", contact: "Ruth Mensah", email: "ruth@verdant.ag", portal: "draft", plan: "Growth", projects: 1, mrr: 650, lastActive: "4d ago", lastActiveTs: 96, health: 61, base: "Harvest Log" },
  { id: "c10", name: "Lumen Design", contact: "Felix Wu", email: "felix@lumen.studio", portal: "live", plan: "Scale", projects: 4, mrr: 1450, lastActive: "18m ago", lastActiveTs: 0.3, health: 89, base: "Design Requests" },
].map((c, i) => ({ ...c, color: PD_CLIENT_COLORS[i % PD_CLIENT_COLORS.length] }));

const PD_PROJECTS = [
  { id: "p1", name: "Q3 Brand Refresh", client: "Northwind Studio", clientId: "c1", status: "in_progress", progress: 64, due: "Jun 28", owner: "Maya Okonkwo", tasks: "12 / 19" },
  { id: "p2", name: "Patient Portal v2", client: "Halcyon Health", clientId: "c2", status: "review", progress: 90, due: "Jun 18", owner: "Devin Park", tasks: "17 / 19" },
  { id: "p3", name: "Listing Microsite", client: "Birchwood Realty", clientId: "c4", status: "blocked", progress: 30, due: "Jul 05", owner: "Sam Hale", tasks: "5 / 16" },
  { id: "p4", name: "Fleet Dashboard", client: "Orbit Logistics", clientId: "c5", status: "in_progress", progress: 48, due: "Jul 12", owner: "Priya Nair", tasks: "9 / 22" },
  { id: "p5", name: "Summer Campaign", client: "Northstar Media", clientId: "c8", status: "review", progress: 82, due: "Jun 20", owner: "Jonah Klein", tasks: "14 / 17" },
  { id: "p6", name: "Content Calendar 2026", client: "Tidewater Co.", clientId: "c3", status: "in_progress", progress: 55, due: "Jul 01", owner: "Lena Brooks", tasks: "11 / 20" },
  { id: "p7", name: "Event Pipeline Setup", client: "Marigold Events", clientId: "c6", status: "done", progress: 100, due: "Jun 10", owner: "Tomas Reyes", tasks: "15 / 15" },
  { id: "p8", name: "Design Request Flow", client: "Lumen Design", clientId: "c10", status: "in_progress", progress: 40, due: "Jul 15", owner: "Felix Wu", tasks: "8 / 20" },
];

const PD_APPROVALS = [
  { id: "a1", title: "Homepage hero — final copy", client: "Northwind Studio", clientId: "c1", type: "Copy", submitted: "Jun 14", by: "Maya Okonkwo", status: "pending" },
  { id: "a2", title: "Patient intake form layout", client: "Halcyon Health", clientId: "c2", type: "Design", submitted: "Jun 14", by: "Devin Park", status: "pending" },
  { id: "a3", title: "Summer campaign — 6 banner set", client: "Northstar Media", clientId: "c8", type: "Asset", submitted: "Jun 13", by: "Jonah Klein", status: "pending" },
  { id: "a4", title: "Listing microsite — color direction", client: "Birchwood Realty", clientId: "c4", type: "Design", submitted: "Jun 13", by: "Sam Hale", status: "pending" },
  { id: "a5", title: "June content calendar", client: "Tidewater Co.", clientId: "c3", type: "Plan", submitted: "Jun 12", by: "Lena Brooks", status: "approved" },
  { id: "a6", title: "Fleet dashboard wireframes", client: "Orbit Logistics", clientId: "c5", type: "Design", submitted: "Jun 11", by: "Priya Nair", status: "approved" },
  { id: "a7", title: "Event landing page", client: "Marigold Events", clientId: "c6", type: "Design", submitted: "Jun 10", by: "Tomas Reyes", status: "changes" },
];

const PD_INVOICES = [
  { id: "INV-2041", client: "Northwind Studio", clientId: "c1", amount: 4350, issued: "Jun 01", due: "Jun 15", status: "paid" },
  { id: "INV-2042", client: "Halcyon Health", clientId: "c2", amount: 5800, issued: "Jun 01", due: "Jun 15", status: "paid" },
  { id: "INV-2043", client: "Orbit Logistics", clientId: "c5", amount: 7250, issued: "Jun 01", due: "Jun 15", status: "due" },
  { id: "INV-2044", client: "Northstar Media", clientId: "c8", amount: 4350, issued: "Jun 01", due: "Jun 15", status: "due" },
  { id: "INV-2039", client: "Cedar & Co.", clientId: "c7", amount: 1950, issued: "May 01", due: "May 15", status: "overdue" },
  { id: "INV-2045", client: "Lumen Design", clientId: "c10", amount: 5800, issued: "Jun 01", due: "Jun 20", status: "due" },
  { id: "INV-2038", client: "Tidewater Co.", clientId: "c3", amount: 1950, issued: "May 01", due: "May 15", status: "paid" },
  { id: "INV-2046", client: "Marigold Events", clientId: "c6", amount: 1950, issued: "Jun 05", due: "Jun 25", status: "draft" },
];

const PD_ACTIVITY = [
  { id: "ac1", icon: "check", tone: "green", who: "Lena Brooks", what: "approved", target: "June content calendar", client: "Tidewater Co.", time: "12m ago" },
  { id: "ac2", icon: "upload", tone: "blue", who: "You", what: "uploaded 6 files to", target: "Summer Campaign", client: "Northstar Media", time: "48m ago" },
  { id: "ac3", icon: "message", tone: "teal", who: "Devin Park", what: "commented on", target: "Patient Portal v2", client: "Halcyon Health", time: "1h ago" },
  { id: "ac4", icon: "card", tone: "green", who: "Northwind Studio", what: "paid", target: "INV-2041", client: "$4,350", time: "2h ago" },
  { id: "ac5", icon: "users", tone: "accent", who: "You", what: "invited", target: "Sam Hale", client: "Birchwood Realty", time: "3h ago" },
  { id: "ac6", icon: "palette", tone: "blue", who: "Felix Wu", what: "updated portal branding for", target: "Lumen Design", client: "", time: "5h ago" },
  { id: "ac7", icon: "checklist", tone: "neutral", who: "Priya Nair", what: "completed 4 tasks in", target: "Fleet Dashboard", client: "Orbit Logistics", time: "6h ago" },
];

// Revenue trend (monthly recurring, last 12 mo)
const PD_REVENUE = [
  { label: "Jul", value: 6200 }, { label: "Aug", value: 6850 }, { label: "Sep", value: 7300 },
  { label: "Oct", value: 7100 }, { label: "Nov", value: 8050 }, { label: "Dec", value: 8600 },
  { label: "Jan", value: 8900 }, { label: "Feb", value: 9400 }, { label: "Mar", value: 9950 },
  { label: "Apr", value: 10400 }, { label: "May", value: 10850 }, { label: "Jun", value: 11300 },
];

// Portal logins per weekday
const PD_LOGINS = [
  { label: "Mon", value: 142 }, { label: "Tue", value: 168 }, { label: "Wed", value: 196 },
  { label: "Thu", value: 174 }, { label: "Fri", value: 158 }, { label: "Sat", value: 64 }, { label: "Sun", value: 48 },
];

Object.assign(window, {
  PD_CLIENTS, PD_PROJECTS, PD_APPROVALS, PD_INVOICES, PD_ACTIVITY, PD_REVENUE, PD_LOGINS,
  PD_PROJECT_STATUS: {
    in_progress: { label: "In progress", tone: "blue" },
    review: { label: "In review", tone: "amber" },
    blocked: { label: "Blocked", tone: "red" },
    done: { label: "Done", tone: "green" },
  },
  PD_INVOICE_STATUS: {
    paid: { label: "Paid", tone: "green" },
    due: { label: "Due", tone: "blue" },
    overdue: { label: "Overdue", tone: "red" },
    draft: { label: "Draft", tone: "neutral" },
  },
  PD_PORTAL_STATUS: {
    live: { label: "Live", tone: "green" },
    draft: { label: "Draft", tone: "neutral" },
    paused: { label: "Paused", tone: "amber" },
  },
});
