import type { WorkamajigSource, WmjUser, WmjClient, WmjProject, WmjAssignment } from "./types";

/**
 * Sample Workamajig data so the intranet runs end-to-end without API access.
 * Shapes match what `WorkamajigApi` returns, so flipping WORKAMAJIG_MODE=api
 * is the only change needed to go live.
 *
 * All people below are fictional placeholders.
 */

const users: WmjUser[] = [
  u("u01", "Aoife", "Byrne", "Creative Director", "Creative", "Dublin"),
  u("u02", "Declan", "Murphy", "Senior Art Director", "Creative", "Dublin"),
  u("u03", "Siobhán", "Walsh", "Head of UX", "UX", "Dublin"),
  u("u04", "Cian", "O'Reilly", "Lead Developer", "Development", "Dublin"),
  u("u05", "Niamh", "Kelly", "Front-end Developer", "Development", "Dublin"),
  u("u06", "Rory", "Fitzgerald", "Analytics Lead", "Analytics", "Dublin"),
  u("u07", "Grace", "Dunne", "Brand Strategist", "Brand", "Dublin"),
  u("u08", "Oisín", "Nolan", "Account Director", "Account", "Dublin"),
  u("u09", "Maya", "Rodriguez", "Executive Creative Director", "Creative", "Boston"),
  u("u10", "Jordan", "Blake", "Senior Copywriter", "Creative", "Boston"),
  u("u11", "Priya", "Natarajan", "UX Research Lead", "UX", "Boston"),
  u("u12", "Marcus", "Chen", "Full-stack Developer", "Development", "Boston"),
  u("u13", "Hannah", "Goldberg", "Director of Analytics", "Analytics", "Boston"),
  u("u14", "Luis", "Ortega", "Brand Planner", "Brand", "Boston"),
  u("u15", "Emily", "Sato", "Social Media Director", "Social", "Boston"),
  u("u16", "Tom", "Whelan", "Head of Video / CP Studios", "Production", "Boston"),
  u("u17", "Fiona", "Lynch", "Media Director", "Media", "Dublin"),
  u("u18", "Sam", "Okafor", "Motion Designer", "Creative", "Boston"),
];

const clients: WmjClient[] = [
  c("c01", "Bus Éireann", "Travel & Tourism"),
  c("c02", "Gorton's", "CPG & Retail"),
  c("c03", "Expedia Cruises", "Travel & Tourism"),
  c("c04", "Seva", "Health"),
  c("c05", "Northlake University", "Education"),
  c("c06", "Harbor Credit Union", "Financial Services"),
  c("c07", "Blackrock Hotels", "Hospitality"),
  c("c08", "Leinster Rugby (sample)", "Sports"),
  c("c09", "Verdant Foods", "CPG & Retail"),
  c("c10", "Mercy Health Network", "Health"),
];

const projects: WmjProject[] = [
  p("p01", "BE-2401", "Bus Éireann – TFI Electrify Campaign", "c01", "Closed", "2025-09-01", "2026-07-10", ["Campaign", "Video", "Social", "OOH"], "Integrated launch for the electric fleet: film, OOH, social and on-bus experience."),
  p("p02", "BE-2402", "Bus Éireann – Website & Journey Planner UX", "c01", "Active", "2026-02-01", undefined, ["Website", "UX", "Research"], "Redesign of journey planning flows and accessibility overhaul."),
  p("p03", "GO-2301", "Gorton's – SXSW Activation", "c02", "Closed", "2025-11-15", "2026-03-20", ["Experiential", "Social", "Video"], "Interactive fisherman experience at SXSW with live social content."),
  p("p04", "GO-2302", "Gorton's – Always-on Social", "c02", "Active", "2025-01-01", undefined, ["Social", "Content", "Analytics"], "Monthly content engine and community management with performance reporting."),
  p("p05", "EX-2401", "Expedia Cruises – Brand Platform", "c03", "Closed", "2025-04-01", "2025-12-15", ["Brand", "Strategy", "Campaign"], "New brand platform and launch campaign across US and Canada."),
  p("p06", "SE-2401", "Seva – Patient Onboarding App", "c04", "Active", "2026-01-15", undefined, ["Product", "UX", "Development", "Research"], "Mobile onboarding flow, clinician dashboard and analytics instrumentation."),
  p("p07", "NU-2501", "Northlake University – Enrolment Campaign 2026", "c05", "Active", "2026-03-01", undefined, ["Campaign", "Media", "Analytics", "Social"], "Undergraduate recruitment: paid social, search, and landing-page CRO."),
  p("p08", "HC-2401", "Harbor Credit Union – Rebrand", "c06", "Closed", "2025-02-01", "2025-10-30", ["Brand", "Identity", "Website"], "Full identity refresh, tone of voice and website rebuild."),
  p("p09", "BH-2501", "Blackrock Hotels – Booking Funnel Optimisation", "c07", "Active", "2026-04-01", undefined, ["Analytics", "CRO", "UX", "Development"], "Experimentation programme on the direct booking funnel."),
  p("p10", "LR-2401", "Leinster Rugby – Season Ticket Film", "c08", "Closed", "2025-06-01", "2025-08-30", ["Video", "Social", "Campaign"], "Hero film and cutdowns for the season ticket drive."),
  p("p11", "VF-2501", "Verdant Foods – Packaging & Retail Launch", "c09", "Active", "2026-05-01", undefined, ["Brand", "Packaging", "Retail", "Photography"], "Range packaging, shopper marketing and product photography."),
  p("p12", "MH-2501", "Mercy Health – Patient Portal Research", "c10", "Active", "2026-06-01", undefined, ["Research", "UX", "Reporting"], "Discovery research, journey mapping and dashboard reporting for the digital team."),
  p("p13", "CP-INT", "CP Internal – Staff Intranet", undefined, "Active", "2026-09-01", undefined, ["Development", "UX", "Design"], "Building staff.connellypartners.com."),
];

const assignments: WmjAssignment[] = [
  // Bus Éireann Electrify
  a("p01", "u01", "Creative Director", 180), a("p01", "u02", "Art Director", 320), a("p01", "u17", "Media Director", 90),
  a("p01", "u16", "Director / Editor", 260), a("p01", "u18", "Motion Design", 140), a("p01", "u08", "Account Director", 120),
  // Bus Éireann UX
  a("p02", "u03", "UX Lead", 210), a("p02", "u04", "Lead Developer", 300), a("p02", "u05", "Front-end", 280), a("p02", "u06", "Analytics", 60), a("p02", "u08", "Account", 70),
  // Gorton's SXSW
  a("p03", "u09", "ECD", 90), a("p03", "u10", "Copywriter", 150), a("p03", "u15", "Social Director", 200), a("p03", "u16", "Video", 120), a("p03", "u12", "Interactive Dev", 160),
  // Gorton's social
  a("p04", "u15", "Social Director", 600), a("p04", "u10", "Copy", 300), a("p04", "u13", "Reporting", 120), a("p04", "u18", "Motion", 220),
  // Expedia Cruises brand
  a("p05", "u09", "ECD", 140), a("p05", "u14", "Brand Planner", 260), a("p05", "u07", "Brand Strategist", 110), a("p05", "u10", "Copy", 180),
  // Seva app
  a("p06", "u11", "UX Research", 240), a("p06", "u03", "UX Design", 120), a("p06", "u12", "Full-stack", 420), a("p06", "u13", "Analytics", 90),
  // Northlake
  a("p07", "u17", "Media", 200), a("p07", "u06", "Analytics", 180), a("p07", "u15", "Paid Social", 140), a("p07", "u05", "Landing pages", 90), a("p07", "u02", "Art Director", 110),
  // Harbor CU rebrand
  a("p08", "u07", "Brand Strategist", 240), a("p08", "u01", "Creative Director", 160), a("p08", "u04", "Lead Developer", 280), a("p08", "u10", "Tone of voice", 60),
  // Blackrock CRO
  a("p09", "u13", "Experimentation Lead", 200), a("p09", "u06", "Analytics", 150), a("p09", "u03", "UX", 90), a("p09", "u12", "Dev", 130),
  // Leinster film
  a("p10", "u16", "Director", 180), a("p10", "u18", "Motion", 100), a("p10", "u15", "Social", 60),
  // Verdant packaging
  a("p11", "u02", "Art Director", 220), a("p11", "u07", "Brand", 80), a("p11", "u14", "Planner", 100),
  // Mercy research
  a("p12", "u11", "Research Lead", 180), a("p12", "u13", "Reporting", 70),
  // Intranet
  a("p13", "u04", "Lead Developer", 80), a("p13", "u03", "UX", 40),
];

function u(userKey: string, firstName: string, lastName: string, title: string, department: string, office: string): WmjUser {
  const email = `${firstName}.${lastName}`.toLowerCase().normalize("NFKD").replace(/[^a-z.]/g, "") + "@connellypartners.com";
  return { userKey, firstName, lastName, email, title, department, officeName: office, isActive: true };
}
function c(clientKey: string, clientName: string, industry: string): WmjClient {
  return { clientKey, clientName, industry };
}
function p(projectKey: string, projectNumber: string, projectName: string, clientKey: string | undefined, status: string, startDate: string, endDate: string | undefined, services: string[], description: string): WmjProject {
  return { projectKey, projectNumber, projectName, clientKey, clientName: clients.find((x) => x.clientKey === clientKey)?.clientName, status, startDate, endDate, services, description };
}
function a(projectKey: string, userKey: string, role: string, hours: number): WmjAssignment {
  const proj = projects.find((x) => x.projectKey === projectKey);
  return { projectKey, userKey, role, hours, firstDate: proj?.startDate, lastDate: proj?.endDate ?? "2026-09-01" };
}

export class MockWorkamajig implements WorkamajigSource {
  async users() { return users; }
  async clients() { return clients; }
  async projects() { return projects; }
  async assignments() { return assignments; }
}

export const mockData = { users, clients, projects, assignments };
