/* global React */
// ============================================================
// Shared sample data for the Offerroom full-product kit.
// One candidate (You), their memory, their base resume, a target
// job, and the per-application artifacts Offerroom generates.
// ============================================================

const CANDIDATE = {
  name: "You",
  fullName: "Maya Okonkwo",
  initials: "MO",
  title: "Senior Product Manager",
  location: "San Francisco, CA",
  visa: "International · work-authorized to Mar 2027",
  email: "maya.okonkwo@example.com",
  phone: "+1 415 555 0142",
  linkedin: "linkedin.example/in/maya-okonkwo",
};

// Auto-extracted profile fields (from latest resume). confidence drives the UI.
const EXTRACTED = [
  { field: "Full name", value: "Maya Okonkwo", confidence: "high" },
  { field: "Current title", value: "Senior Product Manager, Growth", confidence: "high" },
  { field: "Most recent company", value: "Plaid", confidence: "high" },
  { field: "Years of experience", value: "6", confidence: "med" },
  { field: "Location", value: "San Francisco, CA", confidence: "high" },
  { field: "Education", value: "M.S. Information Systems, Carnegie Mellon", confidence: "high" },
  { field: "Top skills", value: "PLG, experimentation, payments, SQL", confidence: "med" },
  { field: "Work authorization", value: "International · work-authorized", confidence: "low" },
];

// Memory: everything dumped into the vector + graph store.
const MEMORY_ITEMS = [
  { kind: "resume", name: "Resume — Okonkwo 2026.pdf", meta: "Parsed · 1 of 3 versions", chunks: 24, icon: "fileText", tone: "cardinal" },
  { kind: "doc", name: "Plaid_Growth_QBR_Q3.pptx", meta: "Transcribed · 41 slides", chunks: 88, icon: "fileText", tone: "slate" },
  { kind: "doc", name: "checkout-experiment-writeup.md", meta: "Indexed", chunks: 12, icon: "fileText", tone: "slate" },
  { kind: "audio", name: "Voice note — the Stripe migration", meta: "Transcribed · 4m 12s", chunks: 9, icon: "mic", tone: "ochre" },
  { kind: "folder", name: "Case studies / 2024", meta: "14 files · indexed", chunks: 132, icon: "folder", tone: "slate" },
  { kind: "life", name: "Personal — marathon, mentoring, travel", meta: "From intake conversation", chunks: 7, icon: "lightbulb", tone: "sage" },
];

const MEMORY_NUDGES = [
  "Tell me about a project you're proud of that isn't on your resume.",
  "Any sports, hobbies, or volunteering? It helps me find common ground in outreach.",
  "What's a time you changed someone's mind at work?",
  "Where have you lived or traveled? Useful for relocation and culture-fit talk.",
  "What's a problem you fixed that nobody asked you to?",
  "Who's the best manager you ever had, and what made them good?",
  "Describe a moment a project nearly failed and how you turned it around.",
  "What kind of work makes you lose track of time?",
  "A skill you have that your title doesn't capture?",
  "What's something you believe about your field that most people disagree with?",
  "Tell me about a mentor or someone you've helped grow.",
  "What would your closest teammate say you're great at?",
  "A decision you made with incomplete data that worked out?",
  "What's a constraint you're navigating right now in your search?",
];

// The single target job used across the tailor flow.
const TARGET_JOB = {
  title: "Senior Product Manager, Payments",
  company: "Stripe",
  location: "San Francisco · Hybrid",
  comp: "$240–290k",
  posted: "3 days ago",
  fit: 0.89,
  source: "Pasted job description",
  jd: [
    "Own the merchant checkout experience end to end, from experimentation to rollout.",
    "Partner with design and engineering to ship payment flows used by millions.",
    "Drive measurable conversion improvements through rigorous A/B testing.",
    "5+ years in product, ideally in fintech or payments.",
  ],
};

// Resume diff: each bullet Offerroom rewrote, with provenance trail.
const RESUME_DIFF = [
  {
    section: "Plaid · Senior Product Manager, Growth",
    bullets: [
      {
        status: "rewritten",
        old: "Led growth initiatives across the onboarding funnel.",
        new: "Owned merchant checkout experimentation at Plaid, shipping 40+ A/B tests that lifted conversion 18% across 2M monthly sessions.",
        why: "Job leads with checkout + experimentation. Surfaced your strongest matching evidence and quantified it.",
        prov: [
          { db: "Vault", label: "Plaid_Growth_QBR_Q3.pptx · slide 12", detail: "“+18% checkout conversion, 41 experiments shipped”" },
          { db: "Graph", label: "Outcome node: checkout-conversion", detail: "Linked to 3 experiments and 1 QBR" },
          { db: "Draft", label: "STAR → résumé bullet", detail: "Result-first phrasing, kept ATS keywords" },
        ],
      },
      {
        status: "kept",
        new: "Built the experimentation platform adopted by 9 product teams.",
        why: "Already strong and relevant. Left unchanged.",
        prov: [{ db: "Vault", label: "Resume — Okonkwo 2026.pdf", detail: "Existing bullet, verbatim" }],
      },
      {
        status: "rewritten",
        old: "Worked with engineering on payment features.",
        new: "Partnered with 12 engineers to launch a redesigned card-entry flow, cutting drop-off 23% in the first quarter.",
        why: "Vague verb replaced with a concrete launch and a number pulled from your writeup.",
        prov: [
          { db: "Vault", label: "checkout-experiment-writeup.md", detail: "“card-entry redesign, -23% drop-off Q1”" },
          { db: "Graph", label: "Story: card-entry redesign", detail: "STAR built from 4 source chunks" },
          { db: "Draft", label: "Tailored to Stripe JD", detail: "Mirrors “card-entry” language in posting" },
        ],
      },
    ],
  },
  {
    section: "Carnegie Mellon · M.S. Information Systems",
    bullets: [
      {
        status: "kept",
        new: "M.S. Information Systems, 2020. Capstone: real-time fraud scoring.",
        why: "Relevant to fintech. Unchanged.",
        prov: [{ db: "Vault", label: "Resume — Okonkwo 2026.pdf", detail: "Education section" }],
      },
    ],
  },
];

// Cover letter, highlighted segments carry provenance.
const COVER = {
  greeting: "Dear Stripe Payments team,",
  paras: [
    [
      { t: "I've spent six years making checkout feel like it isn't there. " },
      { t: "At Plaid I shipped 40 experiments against a single number, conversion, and moved it 18%.", prov: { db: "Vault", label: "Plaid QBR Q3", detail: "Quantified outcome from your work history" } },
      { t: " That's the work your merchant team does every day, and it's the work I want to keep doing." },
    ],
    [
      { t: "What pulled me toward Stripe specifically: " },
      { t: "your recent post on adaptive 3DS and reducing false declines.", prov: { db: "Web", label: "Stripe blog · adaptive authentication", detail: "Found via web search, dated last month" } },
      { t: " I ran a false-decline reduction project at Plaid and know how much craft hides behind one percentage point." },
    ],
    [
      { t: "Outside of work I coach a Saturday running group, ", prov: { db: "Vault", label: "Personal — life history", detail: "From intake conversation, used to connect as a person" } },
      { t: "which is mostly an excuse to debug other people's problems at 7am. I'd love to bring that same energy to your team." },
    ],
  ],
  signoff: "Maya",
};

// Custom application questions Offerroom answered.
const CUSTOM_QA = [
  {
    q: "Why do you want to work at Stripe?",
    a: "I want to work on payments where the bar for craft is highest, and Stripe sets it. I've spent my career on checkout conversion; at Stripe that work compounds across millions of merchants instead of one product.",
    nudge: "Strong, but the second sentence sounds a touch polished. Try saying the merchant part in your own words.",
    chars: 247,
  },
  {
    q: "Describe a time you used data to change a product decision.",
    a: "We assumed users dropped off at card entry because of trust. The data said it was latency: a 600ms validation call. I killed the call, drop-off fell 23%, and we stopped redesigning the trust badges.",
    nudge: "This one reads like you. Leave it.",
    chars: 209,
  },
];

const SWOT = {
  strengths: [
    "Six years of measurable checkout-conversion wins, with numbers.",
    "Rare combination: payments domain depth plus real experimentation rigor.",
    "Built a platform 9 teams adopted, you scale through tooling, not heroics.",
  ],
  weaknesses: [
    "No people-management on paper yet, most senior PM roles want it.",
    "All experience at one company. Reads as less range than you have.",
    "Visa timeline (work authorization to Mar 2027) narrows the eligible employer set.",
  ],
  opportunities: [
    "Payments hiring is up; fintechs want PLG plus experimentation.",
    "Your CMU and Plaid networks reach 4 of your 6 target companies.",
    "A strong negotiation window, two of your roles map to senior bands.",
  ],
  threats: [
    "Senior PM roles increasingly expect direct reports.",
    "Visa sponsorship filters out roughly a third of postings.",
    "Off-cycle timing means smaller cohorts at the big names.",
  ],
};

const ROLE_TIERS = [
  {
    tier: "Safe", tone: "sage",
    blurb: "You clear the bar comfortably. Apply with confidence.",
    roles: [
      { title: "Senior PM, Growth", co: "Plaid · Brex · Mercury", fit: 0.92 },
      { title: "Senior PM, Payments", co: "Adyen · Marqeta", fit: 0.90 },
    ],
  },
  {
    tier: "Progressive", tone: "slate",
    blurb: "A clear step up. Reachable with the right story and a warm intro.",
    roles: [
      { title: "Group PM, Payments", co: "Stripe · Block", fit: 0.84 },
      { title: "Principal PM, Checkout", co: "Shopify", fit: 0.81 },
    ],
  },
  {
    tier: "Dream", tone: "cardinal",
    blurb: "A real stretch. We build toward these and use them to aim high.",
    roles: [
      { title: "Director of Product, Payments", co: "Stripe", fit: 0.71 },
      { title: "Head of Checkout", co: "A late-stage fintech", fit: 0.68 },
    ],
  },
];

// Job tracker, applications with stages.
const TRACKER_STAGES = ["Saved", "To apply", "Applied", "Screen", "Interview", "Offer"];
const TRACKER_JOBS = [
  { id: "stripe", title: "Senior PM, Payments", co: "Stripe", stage: "Interview", tone: "interview", fit: 0.89, updated: "2h ago", next: "Onsite · Thu 2:00 PM", source: "Pasted JD", prep: true },
  { id: "linear", title: "Senior PM", co: "Linear", stage: "Screen", tone: "interview", fit: 0.91, updated: "1d ago", next: "Recruiter screen · Tue", source: "Internal board", prep: true },
  { id: "ramp", title: "Group PM, Payments", co: "Ramp", stage: "Applied", tone: "applied", fit: 0.79, updated: "3d ago", next: "Following up Thu", source: "Chrome extension", prep: false },
  { id: "figma", title: "PM, Editor", co: "Figma", stage: "To apply", tone: "draft", fit: 0.86, updated: "1d ago", next: "Form-fill queued (2m)", source: "Chrome extension", prep: false },
  { id: "vercel", title: "Director, Product", co: "Vercel", stage: "Offer", tone: "offer", fit: 0.88, updated: "5d ago", next: "Negotiation open", source: "Referral", prep: false },
  { id: "brex", title: "Senior PM, Spend", co: "Brex", stage: "Saved", tone: "neutral", fit: 0.83, updated: "6d ago", next: "Not started", source: "Internal board", prep: false },
];

const TRACKER_INSIGHTS = [
  { n: "23", label: "applications this month", tone: "#4A5868" },
  { n: "34%", label: "reply rate", tone: "#5A7150" },
  { n: "5", label: "interviews booked", tone: "#8C1515" },
  { n: "2.1d", label: "median time to reply", tone: "#B08A3E" },
];

// Interview prep, generated dossier + questions.
const PREP_QUESTIONS = {
  behavioral: [
    { q: "Tell me about a time you shipped something that failed.", star: "The trust-badge redesign. We spent a sprint on it, it did nothing, the data said latency. I cut my losses publicly and we moved to the real fix.", source: "Story: card-entry redesign" },
    { q: "How do you handle disagreement with engineering?", star: "On the card-entry flow, eng wanted to keep the validation call. I proposed a one-week holdback test instead of arguing. Data settled it, -23% drop-off.", source: "Story: card-entry redesign" },
  ],
  technical: [
    { q: "Design an experiment to reduce checkout drop-off.", star: "Define the metric (completed-payment rate), instrument the funnel, pick one lever, power the test, guardrail on latency and fraud, ship to 5% first.", source: "Memory: experimentation platform" },
    { q: "How would you reduce false declines without raising fraud?", star: "Segment by risk score, loosen only the low-risk tail, hold out a control, watch chargeback rate as the guardrail.", source: "Web: Stripe adaptive 3DS post" },
  ],
};

const PREP_DOSSIER = {
  interviewer: { name: "Priya Raman", role: "Director of Product, Payments · Stripe", note: "Ex-Square. Writes about checkout latency. Likely to go deep on metrics." },
  company: ["Shipped adaptive 3DS last month.", "Merchant checkout is a 2026 priority per their eng blog.", "Recently expanded the SF payments team."],
  format: "45 min · 1 product sense, 1 metrics deep-dive",
  ask: ["How does the team decide when an experiment is conclusive?", "What's the current biggest source of checkout drop-off?", "How is success measured for this role in the first 6 months?"],
};

// Internal job board.
const BOARD_JOBS = [
  { id: "b1", title: "Senior PM, Payments", co: "Stripe", loc: "SF · Hybrid", comp: "$240–290k", fit: 0.89, sponsor: true, sponsored: false, badge: "High match" },
  { id: "b2", title: "Senior PM, Growth", co: "Brex", loc: "Remote · US", comp: "$220–260k", fit: 0.87, sponsor: true, sponsored: true, badge: "Sponsored" },
  { id: "b3", title: "Group PM, Checkout", co: "Shopify", loc: "Remote", comp: "$250–300k", fit: 0.81, sponsor: true, sponsored: false, badge: "High match" },
  { id: "b4", title: "PM, Payments Risk", co: "Mercury", loc: "SF", comp: "$210–250k", fit: 0.78, sponsor: false, sponsored: false, badge: null },
  { id: "b5", title: "Senior PM, Spend", co: "Ramp", loc: "NYC · Hybrid", comp: "$230–270k", fit: 0.76, sponsor: true, sponsored: true, badge: "Sponsored" },
  { id: "b6", title: "Principal PM, Money Movement", co: "Adyen", loc: "SF", comp: "$260–310k", fit: 0.74, sponsor: true, sponsored: false, badge: null },
];

// Saved base résumés — the master plus earlier saved versions.
const SAVED_RESUMES = [
  { id: "base-v3", name: "Base résumé", template: "Executive", saved: "Today · 2:14 PM", current: true, note: "Master · every tailored version starts here" },
  { id: "base-v2", name: "Base résumé", template: "Classic", saved: "Mar 4", current: false, note: "Earlier save · serif single column" },
  { id: "base-v1", name: "First draft", template: "Modern", saved: "Feb 19", current: false, note: "First pass from your memory" },
];

// Generated, job-tailored résumés Offerroom produced across the search.
const GENERATED_RESUMES = [
  { id: "g-stripe", job: "Senior PM, Payments", co: "Stripe", template: "Executive", date: "Today · 2:31 PM", fit: 0.89, status: "submitted", tone: "interview", changes: 7 },
  { id: "g-linear", job: "Senior PM", co: "Linear", template: "Modern", date: "Yesterday", fit: 0.91, status: "submitted", tone: "interview", changes: 5 },
  { id: "g-ramp", job: "Group PM, Payments", co: "Ramp", template: "Executive", date: "3 days ago", fit: 0.79, status: "draft", tone: "draft", changes: 9 },
  { id: "g-figma", job: "PM, Editor", co: "Figma", template: "Technical", date: "1 week ago", fit: 0.86, status: "saved", tone: "neutral", changes: 6 },
  { id: "g-vercel", job: "Director, Product", co: "Vercel", template: "Executive", date: "2 weeks ago", fit: 0.88, status: "submitted", tone: "interview", changes: 8 },
];

const RESUME_STATUS = {
  submitted: { tone: "interview", label: "Submitted" },
  draft:     { tone: "draft",     label: "Draft" },
  saved:     { tone: "neutral",   label: "Saved" },
};

const PROV_META = {
  Vault: { color: "#4A5868", tint: "#E1E5E9", label: "Vault", sub: "your work history (vector store)" },
  Graph: { color: "#B08A3E", tint: "#F2E9D2", label: "Graph", sub: "extracted stories & outcomes" },
  Draft: { color: "#8C1515", tint: "#F9E9EA", label: "Draft", sub: "tailored to this job" },
  Web:   { color: "#5A7150", tint: "#E4EAE0", label: "Web", sub: "company research" },
};

Object.assign(window, {
  CANDIDATE, EXTRACTED, MEMORY_ITEMS, MEMORY_NUDGES, TARGET_JOB, RESUME_DIFF, COVER,
  CUSTOM_QA, SWOT, ROLE_TIERS, TRACKER_STAGES, TRACKER_JOBS, TRACKER_INSIGHTS,
  PREP_QUESTIONS, PREP_DOSSIER, BOARD_JOBS, PROV_META,
  SAVED_RESUMES, GENERATED_RESUMES, RESUME_STATUS,
});
