// data.jsx — store domain catalog (shared across all pages)
// A tenant pack swaps this whole file to re-skin the storefront: same shape,
// different rows. Nothing here is fetched — inline for the prototype.

// ---- taxonomy ---------------------------------------------------------
const CATEGORIES = [
  { id: "agents", label: "Agents" },
  { id: "skills", label: "Skills" },
  { id: "templates", label: "Templates" },
  { id: "bundles", label: "Bundles" },
  { id: "saas-tools", label: "SaaS Tools" },
  { id: "service-providers", label: "Service Providers" },
];

// mode vocabulary — never mixed on one control
// buy      -> own checkout, solid circuit fill, black text
// partner  -> outbound affiliate, outline circuit, inline disclosure
// provider -> redirect handoff, outline red, one-line "why we send you there"
const MODES = {
  buy: { label: "Buy", cta: "Buy" },
  partner: { label: "Partner", cta: "Go to partner" },
  provider: { label: "Provider", cta: "Open provider" },
};

// ---- reviewer media / staff-reply helpers -----------------------------
function review(id, author, rating, body, opts = {}) {
  return {
    id,
    author,
    rating,
    body,
    date: opts.date || "2026-08",
    media: opts.media || null, // reviewer-media placeholder, browsable
    staffReply: opts.staffReply || null,
  };
}

// ---- catalog ------------------------------------------------------------
const CATALOG = [
  {
    id: "agent-context-engine",
    name: "Context Engine Agent",
    category: "agents",
    mode: "buy",
    price: 240,
    currency: "USD",
    unitPrice: "240 / seat / mo",
    totalCostLine: "$240 + est. $19.20 tax = $259.20 first charge",
    delivery: "Deploys to your workspace in 2 min. No install.",
    returns: "Cancel any time before renewal; pro-rated refund within 14 days.",
    provider: { name: "AaaS Platform", reputationScore: 4.8, reviewCount: 612 },
    bestFor: ["research-heavy teams", "long documents", "recurring context"],
    specs: {
      "Context window": "2M tokens",
      "Refresh cadence": "continuous",
      "Source connectors": "14",
      "Deploy time": "2 min",
      "Seats included": "1",
    },
    reviews: [
      review("r1", "D. Okafor", 5, "Cut our weekly research pass from 3 hours to 40 minutes.", {
        media: "reviewer-clip-01",
        staffReply: "Glad the source-connector refresh is holding up under your load — ping us if you add a 15th connector.",
      }),
      review("r2", "M. Iversen", 4, "Strong on structured docs, still misses some PDF tables."),
    ],
    disclosure: null,
    jsonLd: { "@type": "Product", sku: "agent-context-engine", offers: { "@type": "Offer", priceCurrency: "USD", price: "240" } },
  },
  {
    id: "agent-ops-autopilot",
    name: "Ops Autopilot Agent",
    category: "agents",
    mode: "buy",
    price: 180,
    currency: "USD",
    unitPrice: "180 / seat / mo",
    totalCostLine: "$180 + est. $14.40 tax = $194.40 first charge",
    delivery: "Deploys in 2 min; runbook import supported.",
    returns: "Cancel any time before renewal; pro-rated refund within 14 days.",
    provider: { name: "AaaS Platform", reputationScore: 4.7, reviewCount: 388 },
    bestFor: ["ops teams", "on-call rotations", "incident triage"],
    specs: {
      "Runbooks supported": "unlimited",
      "Escalation channels": "Slack, PagerDuty, email",
      "Deploy time": "2 min",
      "Seats included": "1",
    },
    reviews: [
      review("r3", "T. Nakashima", 5, "Handles our nightly batch failures without waking anyone up."),
    ],
    disclosure: null,
    jsonLd: { "@type": "Product", sku: "agent-ops-autopilot", offers: { "@type": "Offer", priceCurrency: "USD", price: "180" } },
  },
  {
    id: "agent-crm-copilot",
    name: "CRM Agent",
    category: "agents",
    mode: "partner",
    price: 95,
    currency: "USD",
    unitPrice: "95 / seat / mo, billed by partner",
    totalCostLine: "$95 + partner's own tax/fees (shown at partner checkout)",
    delivery: "Provisioned inside the partner CRM after account link.",
    returns: "Governed by the partner's own return policy — see disclosure.",
    provider: { name: "Ledgerline CRM", reputationScore: 4.5, reviewCount: 1204 },
    bestFor: ["sales teams already on Ledgerline", "pipeline hygiene"],
    specs: {
      "Runs inside": "Ledgerline CRM",
      "Account link": "OAuth, 1 min",
      "Data residency": "partner-controlled",
    },
    reviews: [
      review("r4", "P. Adebayo", 4, "Good fit once you're already on Ledgerline. Setup outside it is pointless.", {
        staffReply: "Correct — this agent only makes sense as a Ledgerline add-on, we say so on the card.",
      }),
    ],
    disclosure: "AaaS earns a referral fee from Ledgerline CRM when you activate this agent. Pricing and terms are set by Ledgerline, not AaaS.",
    jsonLd: { "@type": "Product", sku: "agent-crm-copilot", offers: { "@type": "Offer", priceCurrency: "USD", price: "95" } },
  },
  {
    id: "agent-deploy-pipeline",
    name: "Deploy Pipeline Agent",
    category: "agents",
    mode: "buy",
    price: 150,
    currency: "USD",
    unitPrice: "150 / seat / mo",
    totalCostLine: "$150 + est. $12.00 tax = $162.00 first charge",
    delivery: "Deploys in 2 min; reads your existing CI config.",
    returns: "Cancel any time before renewal; pro-rated refund within 14 days.",
    provider: { name: "AaaS Platform", reputationScore: 4.6, reviewCount: 201 },
    bestFor: ["small platform teams", "frequent releases", "rollback safety"],
    specs: {
      "CI providers read": "GitHub Actions, GitLab CI, CircleCI",
      "Rollback": "automatic on failed health check",
      "Deploy time": "2 min",
    },
    reviews: [
      review("r5", "S. Villanueva", 5, "Caught a bad rollout at 2am and rolled back before anyone paged."),
    ],
    disclosure: null,
    jsonLd: { "@type": "Product", sku: "agent-deploy-pipeline", offers: { "@type": "Offer", priceCurrency: "USD", price: "150" } },
  },
  {
    id: "skill-deep-research",
    name: "Deep Research Skill Pack",
    category: "skills",
    mode: "buy",
    price: 38,
    currency: "USD",
    unitPrice: "38 one-time",
    totalCostLine: "$38 + est. $3.04 tax = $41.04",
    delivery: "Installs into any agent in under 1 min.",
    returns: "14-day return, no questions asked.",
    provider: { name: "AaaS Platform", reputationScore: 4.9, reviewCount: 940 },
    bestFor: ["market scans", "competitor teardown", "citation-backed answers"],
    specs: {
      "Skills included": "6",
      "Compatible agents": "any AaaS agent",
      "Update cadence": "monthly",
    },
    reviews: [
      review("r6", "H. Zheng", 5, "The citation formatting alone paid for this pack.", { media: "reviewer-clip-02" }),
      review("r7", "A. Sørensen", 3, "Solid, wish it covered non-English sources better.", {
        staffReply: "Multi-language source coverage is on the near-term roadmap — tracked and not forgotten.",
      }),
    ],
    disclosure: null,
    jsonLd: { "@type": "Product", sku: "skill-deep-research", offers: { "@type": "Offer", priceCurrency: "USD", price: "38" } },
  },
  {
    id: "skill-voice-transcription",
    name: "Voice Transcription Skill Pack",
    category: "skills",
    mode: "buy",
    price: 22,
    currency: "USD",
    unitPrice: "22 one-time",
    totalCostLine: "$22 + est. $1.76 tax = $23.76",
    delivery: "Installs into any agent in under 1 min.",
    returns: "14-day return, no questions asked.",
    provider: { name: "AaaS Platform", reputationScore: 4.7, reviewCount: 355 },
    bestFor: ["call notes", "meeting recaps", "multi-speaker audio"],
    specs: {
      "Skills included": "3",
      "Speaker separation": "up to 8 speakers",
      "Languages": "22",
    },
    reviews: [
      review("r8", "K. Bergström", 4, "Handles overlapping speakers better than most."),
    ],
    disclosure: null,
    jsonLd: { "@type": "Product", sku: "skill-voice-transcription", offers: { "@type": "Offer", priceCurrency: "USD", price: "22" } },
  },
  {
    id: "template-onboarding-flow",
    name: "Onboarding Flow Template",
    category: "templates",
    mode: "buy",
    price: 60,
    currency: "USD",
    unitPrice: "60 one-time",
    totalCostLine: "$60 + est. $4.80 tax = $64.80",
    delivery: "Download link, 1 file, 2 min to import.",
    returns: "14-day return, no questions asked.",
    provider: { name: "AaaS Platform", reputationScore: 4.6, reviewCount: 167 },
    bestFor: ["new-hire agent rollout", "customer activation flows"],
    specs: {
      "Steps included": "9",
      "Format": "agent-guide JSON",
      "Editable": "yes, in guide editor",
    },
    reviews: [
      review("r9", "J. Fontaine", 5, "Shipped our activation flow in an afternoon instead of a sprint."),
    ],
    disclosure: null,
    jsonLd: { "@type": "Product", sku: "template-onboarding-flow", offers: { "@type": "Offer", priceCurrency: "USD", price: "60" } },
  },
  {
    id: "template-support-macros",
    name: "Support Macro Template Set",
    category: "templates",
    mode: "buy",
    price: 45,
    currency: "USD",
    unitPrice: "45 one-time",
    totalCostLine: "$45 + est. $3.60 tax = $48.60",
    delivery: "Download link, 1 file, 2 min to import.",
    returns: "14-day return, no questions asked.",
    provider: { name: "AaaS Platform", reputationScore: 4.5, reviewCount: 98 },
    bestFor: ["support teams", "tier-1 macro coverage"],
    specs: {
      "Macros included": "40",
      "Format": "agent-guide JSON",
      "Tone presets": "3",
    },
    reviews: [
      review("r10", "L. Marchetti", 4, "Good base set, we rewrote a third of them for our voice."),
    ],
    disclosure: null,
    jsonLd: { "@type": "Product", sku: "template-support-macros", offers: { "@type": "Offer", priceCurrency: "USD", price: "45" } },
  },
  {
    id: "bundle-builder-starter",
    name: "Builder Starter Bundle",
    category: "bundles",
    mode: "buy",
    price: 220,
    currency: "USD",
    unitPrice: "220 one-time (3 items, $268 separately)",
    totalCostLine: "$220 + est. $17.60 tax = $237.60",
    delivery: "Bundle unlocks all 3 items immediately after purchase.",
    returns: "14-day return on the bundle as a whole.",
    provider: { name: "AaaS Platform", reputationScore: 4.8, reviewCount: 141 },
    bestFor: ["solo builders", "first automation project"],
    specs: {
      "Includes": "Context Engine Agent (1 seat/mo, 1 month), Deep Research Skill Pack, Onboarding Flow Template",
      "Savings": "18% vs. separate purchase",
    },
    reviews: [
      review("r11", "R. Costa", 5, "Exactly the starter kit I'd have assembled myself, minus the guesswork."),
    ],
    disclosure: null,
    jsonLd: { "@type": "Product", sku: "bundle-builder-starter", offers: { "@type": "Offer", priceCurrency: "USD", price: "220" } },
  },
  {
    id: "bundle-agency-scale",
    name: "Agency Scale Bundle",
    category: "bundles",
    mode: "buy",
    price: 640,
    currency: "USD",
    unitPrice: "640 / mo (5 seats, $812 separately)",
    totalCostLine: "$640 + est. $51.20 tax = $691.20 first charge",
    delivery: "Bundle unlocks all included agents immediately after purchase.",
    returns: "Cancel any time before renewal; pro-rated refund within 14 days.",
    provider: { name: "AaaS Platform", reputationScore: 4.7, reviewCount: 76 },
    bestFor: ["agencies", "multi-client delivery teams"],
    specs: {
      "Includes": "Ops Autopilot Agent, Deploy Pipeline Agent, Support Macro Template Set, 5 seats pooled",
      "Savings": "21% vs. separate purchase",
    },
    reviews: [
      review("r12", "N. Haddad", 4, "Pooled seats across clients is the actual feature, not the discount."),
    ],
    disclosure: null,
    jsonLd: { "@type": "Product", sku: "bundle-agency-scale", offers: { "@type": "Offer", priceCurrency: "USD", price: "640" } },
  },
  {
    id: "saas-ledger-sync",
    name: "Ledger Sync",
    category: "saas-tools",
    mode: "partner",
    price: 29,
    currency: "USD",
    unitPrice: "29 / mo, billed by partner",
    totalCostLine: "$29 + partner's own tax/fees (shown at partner checkout)",
    delivery: "Account created on the partner's site; agent connects after.",
    returns: "Governed by the partner's own return policy — see disclosure.",
    provider: { name: "Ledger Sync Inc.", reputationScore: 4.4, reviewCount: 522 },
    bestFor: ["bookkeeping automation", "multi-currency ledgers"],
    specs: {
      "Runs on": "partner infrastructure",
      "Currencies": "38",
      "Account link": "OAuth, 1 min",
    },
    reviews: [
      review("r13", "E. Larsson", 4, "Reconciliation agent pairs with it cleanly once the accounts are linked."),
    ],
    disclosure: "AaaS earns a referral fee from Ledger Sync Inc. when you subscribe through this link. Pricing and billing are Ledger Sync's, not AaaS's.",
    jsonLd: { "@type": "Product", sku: "saas-ledger-sync", offers: { "@type": "Offer", priceCurrency: "USD", price: "29" } },
  },
  {
    id: "saas-analytics-relay",
    name: "Analytics Relay",
    category: "saas-tools",
    mode: "partner",
    price: 49,
    currency: "USD",
    unitPrice: "49 / mo, billed by partner",
    totalCostLine: "$49 + partner's own tax/fees (shown at partner checkout)",
    delivery: "Account created on the partner's site; agent connects after.",
    returns: "Governed by the partner's own return policy — see disclosure.",
    provider: { name: "Relay Analytics", reputationScore: 4.3, reviewCount: 288 },
    bestFor: ["event pipelines", "cross-tool attribution"],
    specs: {
      "Runs on": "partner infrastructure",
      "Event volume": "10M / mo included",
      "Account link": "OAuth, 1 min",
    },
    reviews: [
      review("r14", "C. Dubois", 3, "Works, dashboard is theirs so expect a learning curve outside AaaS."),
    ],
    disclosure: "AaaS earns a referral fee from Relay Analytics when you subscribe through this link. Pricing and billing are Relay's, not AaaS's.",
    jsonLd: { "@type": "Product", sku: "saas-analytics-relay", offers: { "@type": "Offer", priceCurrency: "USD", price: "49" } },
  },
  {
    id: "provider-compliance-review",
    name: "Compliance Review Service",
    category: "service-providers",
    mode: "provider",
    price: null,
    currency: "USD",
    unitPrice: "quoted after intake",
    totalCostLine: "Quoted by provider after a scoped intake call",
    delivery: "Redirect to provider's booking page; intake call within 3 business days.",
    returns: "Governed by the provider's own engagement terms.",
    provider: { name: "Norwood Compliance Partners", reputationScore: 4.6, reviewCount: 84 },
    bestFor: ["regulated deployments", "SOC 2 / GDPR readiness"],
    specs: {
      "Engagement length": "2-6 weeks typical",
      "Delivery": "provider-run, off-platform",
      "Intake": "scoped call, no cost",
    },
    reviews: [
      review("r15", "F. Muñoz", 5, "Thorough and fast for a compliance shop; worth the handoff."),
    ],
    disclosure: "We send you to Norwood Compliance Partners because they meet our vetting bar for regulated work we don't do in-house. AaaS does not bill or deliver this engagement.",
    jsonLd: { "@type": "Service", sku: "provider-compliance-review" },
  },
  {
    id: "provider-fine-tune-lab",
    name: "Fine-Tune Partner Lab",
    category: "service-providers",
    mode: "provider",
    price: null,
    currency: "USD",
    unitPrice: "quoted after intake",
    totalCostLine: "Quoted by provider after a scoped intake call",
    delivery: "Redirect to provider's booking page; intake call within 5 business days.",
    returns: "Governed by the provider's own engagement terms.",
    provider: { name: "Latch Model Lab", reputationScore: 4.5, reviewCount: 47 },
    bestFor: ["custom model fine-tuning", "domain-specific evals"],
    specs: {
      "Engagement length": "3-8 weeks typical",
      "Delivery": "provider-run, off-platform",
      "Intake": "scoped call, no cost",
    },
    reviews: [
      review("r16", "G. Petrov", 4, "Solid eval rigor. Slower than we hoped but the model held up in production.", {
        staffReply: "Timeline feedback passed to Latch directly — thanks for the detail.",
      }),
    ],
    disclosure: "We send you to Latch Model Lab because they meet our vetting bar for fine-tuning work we don't do in-house. AaaS does not bill or deliver this engagement.",
    jsonLd: { "@type": "Service", sku: "provider-fine-tune-lab" },
  },
];

// ---- lookups --------------------------------------------------------------
function getItem(id) { return CATALOG.find((i) => i.id === id); }
function itemsByCategory(cat) { return CATALOG.filter((i) => i.category === cat); }
function itemsByMode(mode) { return CATALOG.filter((i) => i.mode === mode); }

// ---- finder / agent-guide scripted conversation ---------------------------
// Drives both the persistent Agent Guide panel and the PLP finder (same
// component, sections.jsx: AgentGuide).
const GUIDE_SCRIPT = {
  intro: "Tell me what you're trying to get done and I'll point at the right thing.",
  questions: [
    {
      id: "goal",
      prompt: "What's the job?",
      options: [
        { value: "research", label: "Research & context" },
        { value: "ops", label: "Ops & incidents" },
        { value: "sales", label: "Sales & CRM" },
        { value: "compliance", label: "Compliance / regulated work" },
      ],
    },
    {
      id: "scale",
      prompt: "Solo, team, or agency?",
      options: [
        { value: "solo", label: "Solo builder" },
        { value: "team", label: "In-house team" },
        { value: "agency", label: "Agency, multi-client" },
      ],
    },
  ],
  // maps (goal, scale) -> recommended item id
  recommend(answers) {
    const { goal, scale } = answers;
    if (goal === "compliance") return "provider-compliance-review";
    if (goal === "sales") return "agent-crm-copilot";
    if (goal === "ops" && scale === "agency") return "bundle-agency-scale";
    if (goal === "ops") return "agent-ops-autopilot";
    if (goal === "research" && scale === "solo") return "bundle-builder-starter";
    if (goal === "research") return "agent-context-engine";
    return "bundle-builder-starter";
  },
};

Object.assign(window, {
  CATEGORIES, MODES, CATALOG, getItem, itemsByCategory, itemsByMode, GUIDE_SCRIPT,
});
