import type { BrandScore, Business, OnboardingInput, Opportunity, Recommendation } from "@/lib/types";
import { attachDemoDigitalPresence } from "@/lib/demo-digital-presence";
import { enrichBusinessWithRoles } from "@/lib/role-intelligence";

export interface DemoProfileMeta {
  id: string;
  name: string;
  industry: string;
  location: string;
  tagline: string;
  revenueRange: string;
  revenuePotential: number;
  brandScore: number;
  accent: string;
  /** Used for demo page filtering */
  category?: "startup" | "trades" | "services" | "b2b";
}

const now = () => new Date().toISOString();

function metrics(opportunities: Opportunity[], recommendations: Recommendation[], topPriority: string) {
  return {
    opportunitiesFound: opportunities.length,
    recommendedActions: recommendations.length,
    revenuePotential: opportunities.reduce((s, o) => s + o.estimatedValue, 0),
    topPriorityToday: topPriority,
  };
}

function score(
  overall: number,
  visibility: number,
  trust: number,
  demand: number,
  conversion: number,
  advocacy: number,
  growth: number,
  market: number,
  competitive: number,
  suggestions: BrandScore["suggestions"]
): BrandScore {
  return {
    overall,
    visibility,
    trust,
    demand,
    conversion,
    advocacy,
    growthScore: growth,
    marketOpportunityScore: market,
    competitiveRiskScore: competitive,
    suggestions,
  };
}

const apexRoofingInput: OnboardingInput = {
  businessName: "Apex Roofing Co.",
  websiteUrl: "https://apexroofingco.com",
  industry: "Roofing Company",
  industryCategory: "Home Services",
  businessSubtype: "Roofing",
  location: "Austin, TX",
  businessType: "Local Service Business",
  monthlyRevenueRange: "$20K–$50K/mo",
  revenueGoal: "Hit $80K/mo within 12 months",
  biggestChallenge: "Leads dry up in slow season and we lose jobs to cheaper competitors",
  productsServices: "Roof replacement, storm damage repair, gutter installation, free inspections",
  mainCompetitors: "Lone Star Roofing, Texas Top Roof, Summit Exteriors",
  targetCustomer: "Homeowners aged 35–65 with homes 15+ years old, especially after hail season",
};

const glowStudioInput: OnboardingInput = {
  businessName: "Glow Studio Med Spa",
  websiteUrl: "https://glowstudiomiami.com",
  industry: "Med Spa",
  industryCategory: "Beauty",
  businessSubtype: "Medical Spas",
  location: "Miami, FL",
  businessType: "Brick-and-Mortar",
  monthlyRevenueRange: "$50K–$100K/mo",
  revenueGoal: "Grow to 2 locations and $150K/mo combined",
  biggestChallenge: "High ad costs and clients booking once then never returning",
  productsServices: "Botox, fillers, laser hair removal, HydraFacial, membership packages",
  mainCompetitors: "SkinLab Miami, Radiance Aesthetics, Bella Med Spa",
  targetCustomer: "Women 28–55 with disposable income who want premium, trusted aesthetic care",
};

const stacklineInput: OnboardingInput = {
  businessName: "Stackline",
  websiteUrl: "https://stackline.io",
  industry: "SaaS Company",
  industryCategory: "Technology",
  businessSubtype: "SaaS Companies",
  location: "Remote (US)",
  businessType: "Software Company",
  monthlyRevenueRange: "$5K–$20K/mo",
  revenueGoal: "Reach $50K MRR in 9 months",
  biggestChallenge: "Long sales cycles and low demo-to-close conversion",
  productsServices: "Workflow automation platform for ops teams, onboarding concierge, API integrations",
  mainCompetitors: "Zapier, Make, Monday.com",
  targetCustomer: "Ops leaders at 20–200 person companies drowning in manual processes",
};

const farmTableInput: OnboardingInput = {
  businessName: "Farm Table Kitchen",
  websiteUrl: "https://farmtablepdx.com",
  industry: "Restaurant",
  industryCategory: "Restaurants & Food",
  businessSubtype: "Restaurants",
  location: "Portland, OR",
  businessType: "Restaurant & Catering",
  monthlyRevenueRange: "$50K–$100K/mo",
  revenueGoal: "Increase catering revenue to 40% of total sales",
  biggestChallenge: "Weekday lunch traffic is weak and catering inquiries go unanswered",
  productsServices: "Farm-to-table dining, corporate catering, private events, meal prep boxes",
  mainCompetitors: "Harvest House, Green Fork Catering, Portland Provisions",
  targetCustomer: "Food-conscious professionals and companies hosting events in Portland metro",
};

const momentumInput: OnboardingInput = {
  businessName: "Momentum Fitness",
  websiteUrl: "https://momentumfitdenver.com",
  industry: "Gym",
  industryCategory: "Fitness",
  businessSubtype: "Gyms",
  location: "Denver, CO",
  businessType: "Gym & Coaching",
  monthlyRevenueRange: "$20K–$50K/mo",
  revenueGoal: "Sign 60 new members and launch online coaching tier",
  biggestChallenge: "January rush fades by March and retention drops below 70%",
  productsServices: "Small-group training, 1:1 coaching, nutrition plans, corporate wellness",
  mainCompetitors: "CrossFit Mile High, F45 Denver, Orange Theory LoDo",
  targetCustomer: "Busy professionals 30–50 who want accountability and results, not just a gym card",
};

const greenEdgeInput: OnboardingInput = {
  businessName: "GreenEdge Landscaping",
  websiteUrl: "https://greenedgelscape.com",
  industry: "Landscaping Company",
  industryCategory: "Home Services",
  businessSubtype: "Landscaping",
  location: "Nashville, TN",
  businessType: "Local Service Business",
  monthlyRevenueRange: "$20K–$50K/mo",
  revenueGoal: "Reach $90K/mo and add a maintenance subscription tier",
  biggestChallenge: "Seasonal revenue swings and losing bids to low-ball competitors",
  productsServices: "Landscape design, lawn maintenance, hardscaping, irrigation, seasonal cleanup",
  mainCompetitors: "Tennessee Turf Pros, Nashville Lawn Co, Southern Roots Landscaping",
  targetCustomer: "Homeowners in upscale Nashville suburbs with 0.25+ acre lots who value curb appeal",
};

const vitalMedInput: OnboardingInput = {
  businessName: "VitalMed Supply Co.",
  websiteUrl: "https://vitalmedsupply.com",
  industry: "Pharmacy",
  industryCategory: "Healthcare",
  businessSubtype: "Pharmacies",
  location: "Dallas, TX",
  businessType: "B2B Distributor",
  monthlyRevenueRange: "$50K–$100K/mo",
  revenueGoal: "Hit $200K/mo and expand into 3 new hospital systems",
  biggestChallenge: "Long procurement cycles and getting in front of clinic purchasing managers",
  productsServices: "Surgical supplies, diagnostic equipment, PPE, wound care, clinic consumables",
  mainCompetitors: "MedLine Regional, Texas Surgical Supply, HealthCore Distributors",
  targetCustomer: "Clinic administrators and procurement managers at outpatient surgery centers and multi-location practices",
};

const clearSmileInput: OnboardingInput = {
  businessName: "ClearSmile Dental Group",
  websiteUrl: "https://clearsmiledental.com",
  industry: "Dental Practice",
  industryCategory: "Healthcare",
  businessSubtype: "Dentists",
  location: "Phoenix, AZ",
  businessType: "Healthcare Practice",
  monthlyRevenueRange: "$50K–$100K/mo",
  revenueGoal: "Grow cosmetic dentistry to 35% of revenue",
  biggestChallenge: "New patient flow dropped after a competitor opened 2 miles away",
  productsServices: "General dentistry, Invisalign, veneers, teeth whitening, emergency dental",
  mainCompetitors: "Desert Dental Care, Smile Studio Phoenix, BrightNow Dental",
  targetCustomer: "Families and professionals 25–55 in east Phoenix who want modern, anxiety-free dental care",
};

const comfortZoneInput: OnboardingInput = {
  businessName: "ComfortZone HVAC",
  websiteUrl: "https://comfortzonehvac.com",
  industry: "HVAC Company",
  industryCategory: "Home Services",
  businessSubtype: "HVAC",
  location: "Atlanta, GA",
  businessType: "Local Service Business",
  monthlyRevenueRange: "$20K–$50K/mo",
  revenueGoal: "Double maintenance contract base to 400 subscribers",
  biggestChallenge: "Emergency calls are profitable but maintenance contracts aren't selling",
  productsServices: "AC repair, furnace install, maintenance plans, duct cleaning, smart thermostat setup",
  mainCompetitors: "CoolAir Atlanta, Peachtree Heating & Air, One Hour Heating",
  targetCustomer: "Homeowners in Atlanta suburbs with systems 8+ years old who want reliable year-round comfort",
};

const luxeRealtyInput: OnboardingInput = {
  businessName: "Luxe Realty Partners",
  websiteUrl: "https://luxerealtypartners.com",
  industry: "Real Estate Team",
  industryCategory: "Real Estate",
  businessSubtype: "Realtors",
  location: "Charlotte, NC",
  businessType: "Brokerage",
  monthlyRevenueRange: "$50K–$100K/mo",
  revenueGoal: "Close 40 transactions this year and build a investor client niche",
  biggestChallenge: "Lead gen depends on Zillow and fees are eating margins",
  productsServices: "Residential sales, luxury listings, investor acquisitions, property staging consultations",
  mainCompetitors: "Allen Tate, Helen Adams Realty, Compass Charlotte",
  targetCustomer: "Move-up buyers and investors in Charlotte's SouthPark and Ballantyne markets",
};

function buildGreenEdgeLandscaping(): Business {
  const input = greenEdgeInput;
  const opportunities: Opportunity[] = [
    { id: "ge-opp-1", title: "HOA landscape RFP in Brentwood", type: "buyer", description: "Brentwood Hills HOA posted a landscape maintenance RFP for 120 homes — deadline Monday.", source: "Mock: Local RFP signal", estimatedValue: 24000, confidenceScore: 78, urgencyScore: 95, recommendedAction: "Submit proposal with 3-tier maintenance packages by Sunday", aiOutreach: "Hi {{name}} — GreenEdge specializes in HOA communities in Brentwood. Attached is our proposal for seasonal maintenance, irrigation audits, and storm cleanup for Brentwood Hills.", status: "new" },
    { id: "ge-opp-2", title: "Tennessee Turf Pros pricing complaints", type: "competitor_weakness", description: "14 Google reviews mention hidden fees and damaged plants after Tennessee Turf Pros jobs.", source: "Mock: Google Reviews analysis", estimatedValue: 6800, confidenceScore: 81, urgencyScore: 72, recommendedAction: "Run 'Transparent Pricing Guarantee' ads in Brentwood and Franklin zip codes", status: "saved" },
    { id: "ge-opp-3", title: "Spring cleanup package launch", type: "product", description: "Historical data: 40% of annual revenue comes from March–May projects. No packaged spring offer exists.", source: "Mock: Offer performance model", estimatedValue: 9200, confidenceScore: 86, urgencyScore: 88, recommendedAction: "Launch $899 Spring Revival package — mulch, trim, bed refresh, irrigation check", aiOutreach: "🌿 Spring Revival Package: mulch + trim + bed refresh + irrigation audit for $899. Limited to 30 Nashville homes. Book now → greenedgelscape.com/spring", status: "in_progress" },
    { id: "ge-opp-4", title: "Before/after curb appeal content", type: "content", description: "Hardscaping projects get 8x engagement on Instagram but you post them quarterly.", source: "Mock: Search trend signal", estimatedValue: 3200, confidenceScore: 79, urgencyScore: 55, recommendedAction: "Film 4 before/after reels from recent Franklin hardscape jobs this week", status: "new" },
    { id: "ge-opp-5", title: "Realtor staging partnership", type: "partnership", description: "Top Charlotte-area realtors refer landscapers for pre-listing curb appeal — no formal partner in Nashville.", source: "Mock: Local business network", estimatedValue: 11000, confidenceScore: 70, urgencyScore: 60, recommendedAction: "Email 8 Nashville realtors with pre-listing curb appeal package and referral fee", status: "new" },
    { id: "ge-opp-6", title: "Review volume gap vs Nashville Lawn Co", type: "reputation", description: "You're 4.7★ with 41 reviews. Nashville Lawn Co has 4.3★ with 156 reviews — outranking you locally.", source: "Mock: Review monitoring", estimatedValue: 4100, confidenceScore: 84, urgencyScore: 62, recommendedAction: "Text last 25 completed clients a review link with photo upload prompt", status: "new" },
    { id: "ge-opp-7", title: "Franklin affluent lot expansion", type: "geographic", description: "Franklin 37064 has high median home values but zero GreenEdge ad presence.", source: "Mock: Geographic demand map", estimatedValue: 7400, confidenceScore: 73, urgencyScore: 58, recommendedAction: "Launch Franklin geo-targeted Meta ads with free landscape assessment", status: "new" },
    { id: "ge-opp-8", title: "Monthly maintenance subscription tier", type: "pricing", description: "Only 18% of clients are on recurring maintenance. Competitors offer $149/mo plans.", source: "Mock: Competitive pricing scan", estimatedValue: 8600, confidenceScore: 80, urgencyScore: 70, recommendedAction: "Introduce $179/mo Essential Care plan with annual contract discount", status: "new" },
    { id: "ge-opp-9", title: "Commercial property management niche", type: "market_gap", description: "3 property managers in Nashville need reliable landscape vendors — no commercial landing page.", source: "Mock: Market scan", estimatedValue: 18000, confidenceScore: 67, urgencyScore: 52, recommendedAction: "Build commercial services page and pitch 3 property managers this week", status: "new" },
  ];
  const recommendations: Recommendation[] = [
    { id: "ge-rec-1", title: "Submit Brentwood Hills HOA proposal by Sunday", whyItMatters: "$24,000 annual contract at 78% confidence. Deadline Monday — largest deal in pipeline.", whatToDoNext: "Draft 3-tier proposal tonight. Include storm cleanup SLA and irrigation audit.", revenuePotential: 24000, priority: "high", socialPost: "HOA board looking for reliable landscape partners? GreenEdge maintains 12 Nashville communities. Free assessment → link in bio", emailDraft: "Subject: Brentwood Hills landscape proposal\n\nHi {{name}},\n\nAttached is GreenEdge's proposal for Brentwood Hills — seasonal maintenance, irrigation management, and storm response.\n\nHappy to walk the board through it Monday.\n\n— GreenEdge Landscaping", offerIdea: "HOA Launch: First month maintenance free for communities signing 12-month contracts", landingHeadline: "Nashville's Trusted HOA & Estate Landscape Partner" },
    { id: "ge-rec-2", title: "Launch Spring Revival package before competitors", whyItMatters: "40% of annual revenue happens March–May. Package offer converts 2x vs à la carte quotes.", whatToDoNext: "Publish spring landing page and email past clients today.", revenuePotential: 9200, priority: "high", adConcept: "Headline: $899 Spring Revival for Nashville Homes. Sub: Mulch, trim, beds, irrigation check. 30 spots only." },
    { id: "ge-rec-3", title: "Target Tennessee Turf Pros switchers", whyItMatters: "14 recent complaints about hidden fees — buyers are actively shopping.", whatToDoNext: "Run transparent pricing ads in Brentwood/Franklin with guarantee badge.", revenuePotential: 6800, priority: "medium" },
  ];
  return {
    id: "demo-greenedge-landscaping", createdAt: now(), updatedAt: now(), input,
    profile: {
      companySummary: "GreenEdge Landscaping is a premium residential and HOA landscaper in Nashville doing $20K–$50K/mo. Strong craftsmanship reputation but seasonal swings and low-ball competition limit path to $90K/mo and recurring maintenance revenue.",
      brandPositioning: "Nashville's curb-appeal specialists — design-forward landscaping with transparent pricing and HOA-grade reliability.",
      targetAudience: input.targetCustomer, productsServices: input.productsServices,
      strengths: ["4.7★ rating with standout hardscape portfolio", "Experienced crew with irrigation certification", "Strong word-of-mouth in Brentwood/Franklin"],
      weaknesses: ["Seasonal revenue volatility — winter is thin", "Only 18% of clients on maintenance subscriptions", "Review volume trails lower-rated competitors"],
      marketOpportunities: ["Brentwood Hills HOA RFP — $24K annual", "Spring package season starting — $9.2K quick win", "Commercial property management niche untapped", "Realtor pre-listing partnership channel"],
      suggestedCompetitors: ["Tennessee Turf Pros", "Nashville Lawn Co", "Southern Roots Landscaping"],
      brandImprovements: ["Launch $179/mo maintenance subscription tier", "Publish weekly before/after hardscape content", "Build commercial/HOA landing page separate from residential", "Automate post-job review requests via SMS"],
    },
    opportunities,
    competitors: [
      { id: "ge-comp-1", name: "Tennessee Turf Pros", website: "https://tnurfpros.example", strengths: ["Low pricing", "Fast quote turnaround", "Large crew"], weaknesses: ["Hidden fees (14 complaints)", "Plant damage reports", "3.9★ rating"], positioning: "Budget lawn care and basic landscaping", pricingNotes: "Undercuts by 20–30% — quality reflects price", customerComplaints: ["Added fees after quote", "Killed my shrubs", "Never showed for follow-up"], beatOpportunity: "Win on transparent pricing and craftsmanship — 'No surprise invoices, ever.'" },
      { id: "ge-comp-2", name: "Nashville Lawn Co", website: "https://nashvillelawn.example", strengths: ["156 Google reviews", "Strong SEO", "Maintenance focus"], weaknesses: ["4.3★ rating", "Generic designs", "No hardscaping capability"], positioning: "Volume lawn maintenance provider", pricingNotes: "$129/mo maintenance — commodity positioning", customerComplaints: ["Cookie-cutter approach", "Missed appointments", "No design expertise"], beatOpportunity: "Capture upscale clients who want design + maintenance, not mow-and-go." },
      { id: "ge-comp-3", name: "Southern Roots Landscaping", website: "https://southernroots.example", strengths: ["Beautiful design portfolio", "Instagram presence", "Native plant expertise"], weaknesses: ["6-week lead times", "Premium pricing limits volume", "No maintenance offering"], positioning: "High-end landscape design studio", pricingNotes: "Design projects start at $15K+", customerComplaints: ["Booked out for months", "Too expensive for maintenance"], beatOpportunity: "Offer design excellence WITH ongoing maintenance — they design, you don't maintain." },
    ],
    recommendations,
    brandScore: score(74, 70, 76, 72, 68, 66, 78, 80, 54, { visibility: "Post weekly before/after hardscape reels — your portfolio sells itself.", trust: "Push reviews from 41 to 80+ with post-project SMS requests.", demand: "Launch Spring Revival package before March ends.", conversion: "Add transparent pricing guarantee to homepage hero.", advocacy: "Referral program: $100 credit for every neighbor referral." }),
    metrics: metrics(opportunities, recommendations, "HOA landscape RFP in Brentwood"),
    aiSummary: "GreenEdge's top play is the Brentwood Hills HOA RFP — $24K annual, due Monday. Spring season is your revenue engine: launch the $899 Spring Revival package this week before competitors fill schedules. Tennessee Turf Pros' hidden-fee complaints create a displacement window in Brentwood/Franklin. Total active opportunity value: $94,300.",
  };
}

function buildVitalMedSupply(): Business {
  const input = vitalMedInput;
  const opportunities: Opportunity[] = [
    { id: "vm-opp-1", title: "Outpatient surgery center RFP", type: "buyer", description: "Summit Surgical Center (Dallas) issued an RFP for surgical consumables — $180K annual contract.", source: "Mock: Procurement portal signal", estimatedValue: 180000, confidenceScore: 72, urgencyScore: 91, recommendedAction: "Submit RFP response with volume pricing and same-day delivery SLA by Wednesday", aiOutreach: "Hi {{name}} — VitalMed Supply specializes in outpatient surgical centers across DFW. Our proposal includes same-day delivery, dedicated account management, and 12% below your current MedLine contract. Can we present Thursday?", status: "new" },
    { id: "vm-opp-2", title: "MedLine Regional stockout complaints", type: "competitor_weakness", description: "3 Dallas clinics posted in a procurement forum about MedLine backorders on wound care supplies.", source: "Mock: Industry forum signal", estimatedValue: 42000, confidenceScore: 79, urgencyScore: 86, recommendedAction: "Outbound to 8 affected clinics with in-stock guarantee and sample kits", status: "saved" },
    { id: "vm-opp-3", title: "Wound care SKU expansion", type: "product", description: "Wound care is 22% of revenue but only 8 SKUs. Clinics request advanced dressings you don't carry.", source: "Mock: Offer performance model", estimatedValue: 28000, confidenceScore: 83, urgencyScore: 68, recommendedAction: "Add 12 advanced wound care SKUs and email existing accounts with new catalog", status: "in_progress" },
    { id: "vm-opp-4", title: "Compliance checklist lead magnet", type: "content", description: "Procurement managers search 'clinic supply compliance checklist' — no VitalMed content ranks.", source: "Mock: Search trend signal", estimatedValue: 12000, confidenceScore: 74, urgencyScore: 55, recommendedAction: "Publish free FDA compliance checklist PDF and promote on LinkedIn", aiOutreach: "Post: Is your clinic supply vendor FDA-compliant? Download our free 12-point audit checklist → vitalmedsupply.com/compliance", status: "new" },
    { id: "vm-opp-5", title: "GPO partnership application", type: "partnership", description: "Texas Independent Physician Association GPO accepts regional distributors — VitalMed not listed.", source: "Mock: Partnership directory", estimatedValue: 65000, confidenceScore: 65, urgencyScore: 50, recommendedAction: "Apply to TIPA GPO vendor program with reference accounts", status: "new" },
    { id: "vm-opp-6", title: "G2/industry directory gap", type: "reputation", description: "HealthCore has 40+ testimonials on industry directories. VitalMed has 4.", source: "Mock: Review monitoring", estimatedValue: 8500, confidenceScore: 80, urgencyScore: 58, recommendedAction: "Request testimonials from 10 top accounts for VitalMed website and GPO application", status: "new" },
    { id: "vm-opp-7", title: "Fort Worth clinic cluster expansion", type: "geographic", description: "12 outpatient centers opened in Fort Worth in 18 months. Zero VitalMed sales coverage.", source: "Mock: Geographic demand map", estimatedValue: 54000, confidenceScore: 71, urgencyScore: 62, recommendedAction: "Hire part-time Fort Worth rep and launch targeted LinkedIn outreach campaign", status: "new" },
    { id: "vm-opp-8", title: "Volume tier pricing restructure", type: "pricing", description: "Current pricing loses deals above $50K/mo orders. Competitors offer sliding volume tiers.", source: "Mock: Competitive pricing scan", estimatedValue: 36000, confidenceScore: 77, urgencyScore: 60, recommendedAction: "Introduce 3-tier volume pricing and update proposal template", status: "new" },
    { id: "vm-opp-9", title: "Diagnostic equipment rental niche", type: "market_gap", description: "Small clinics want diagnostic equipment without capital purchase — no rental program exists.", source: "Mock: Market scan", estimatedValue: 48000, confidenceScore: 68, urgencyScore: 48, recommendedAction: "Pilot equipment rental program for 3 clinic partners", status: "new" },
  ];
  const recommendations: Recommendation[] = [
    { id: "vm-rec-1", title: "Submit Summit Surgical Center RFP by Wednesday", whyItMatters: "$180K annual contract — largest deal in pipeline. 72% confidence with existing relationship.", whatToDoNext: "Finalize volume pricing sheet. Schedule presentation with procurement director Thursday.", revenuePotential: 180000, priority: "high", emailDraft: "Subject: VitalMed proposal for Summit Surgical Center\n\nHi {{name}},\n\nAttached is our RFP response including same-day DFW delivery, dedicated account manager, and volume pricing 12% below current contract.\n\nAvailable to present Thursday at your convenience.\n\n— VitalMed Supply Co.", dmMessage: "Hi {{name}} — saw Summit's consumables RFP. VitalMed serves 40+ outpatient centers in DFW with same-day delivery. Worth a 20-min call to compare?", offerIdea: "New Account Launch: 90-day price lock + free compliance audit for centers switching from MedLine", landingHeadline: "DFW's Fastest Medical Supply Partner for Outpatient Surgery Centers" },
    { id: "vm-rec-2", title: "Capture MedLine stockout switchers this week", whyItMatters: "3 clinics actively seeking new wound care vendor — stockout pain is immediate.", whatToDoNext: "Email 8 DFW clinics with in-stock guarantee and complimentary sample kits.", revenuePotential: 42000, priority: "high", socialPost: "Clinic admins: tired of backorders? VitalMed guarantees in-stock on core wound care SKUs. Same-day DFW delivery. DM for catalog." },
    { id: "vm-rec-3", title: "Expand wound care catalog to stop SKU leakage", whyItMatters: "Clinics buying advanced dressings elsewhere — $28K recoverable revenue from existing accounts.", whatToDoNext: "Add 12 SKUs and email catalog update to top 30 accounts.", revenuePotential: 28000, priority: "medium" },
  ];
  return {
    id: "demo-vitalmed-supply", createdAt: now(), updatedAt: now(), input,
    profile: {
      companySummary: "VitalMed Supply Co. is a B2B medical products distributor in Dallas doing $50K–$100K/mo, serving outpatient surgery centers and multi-location clinics. Strong delivery reliability but long procurement cycles and limited catalog breadth limit growth toward $200K/mo.",
      brandPositioning: "DFW's responsive medical supply partner — same-day delivery, compliance-ready, and priced for growing outpatient centers.",
      targetAudience: input.targetCustomer, productsServices: input.productsServices,
      strengths: ["Same-day DFW delivery on core SKUs", "Dedicated account managers for top 20 clients", "FDA compliance documentation ready for audits"],
      weaknesses: ["Only 8 wound care SKUs — clients buy elsewhere for advanced products", "4 testimonials vs competitors' 40+", "No Fort Worth sales coverage"],
      marketOpportunities: ["Summit Surgical Center RFP — $180K annual", "MedLine stockout switchers in DFW", "Fort Worth clinic cluster — 12 new centers", "Diagnostic equipment rental untapped"],
      suggestedCompetitors: ["MedLine Regional", "Texas Surgical Supply", "HealthCore Distributors"],
      brandImprovements: ["Expand wound care catalog to 20+ SKUs", "Apply to TIPA GPO vendor program", "Publish compliance checklist lead magnet on LinkedIn", "Launch 3-tier volume pricing for $50K+ accounts"],
    },
    opportunities,
    competitors: [
      { id: "vm-comp-1", name: "MedLine Regional", website: "https://medlineregional.example", strengths: ["National brand", "Broad catalog", "GPO contracts"], weaknesses: ["Frequent backorders on wound care", "Slow account response", "Impersonal service"], positioning: "National medical supply distributor", pricingNotes: "Volume discounts but rigid contracts", customerComplaints: ["Backordered 3 weeks", "Can't reach account rep", "Minimum order too high"], beatOpportunity: "Win switchers on in-stock guarantee and same-day local delivery." },
      { id: "vm-comp-2", name: "Texas Surgical Supply", website: "https://txsurgical.example", strengths: ["Deep surgical SKU catalog", "Competitive pricing", "Local warehouse"], weaknesses: ["No compliance support", "Weak digital ordering", "Limited diagnostic equipment"], positioning: "Regional surgical supply wholesaler", pricingNotes: "5–10% below VitalMed on commodity SKUs", customerComplaints: ["Ordering portal is outdated", "No compliance docs provided", "Delivery inconsistent"], beatOpportunity: "Win on compliance documentation and account management — they sell boxes, you sell partnership." },
      { id: "vm-comp-3", name: "HealthCore Distributors", website: "https://healthcore.example", strengths: ["40+ client testimonials", "Strong GPO relationships", "Equipment financing"], weaknesses: ["Higher pricing", "2-day delivery standard", "Corporate bureaucracy"], positioning: "Full-service medical distributor with financing", pricingNotes: "Premium pricing with financing options", customerComplaints: ["Too expensive for small clinics", "Takes days to get quotes", "Hard to reach decision-makers"], beatOpportunity: "Target mid-size outpatient centers priced out of HealthCore — faster, leaner, local." },
    ],
    recommendations,
    brandScore: score(76, 68, 82, 74, 70, 65, 79, 85, 58, { visibility: "Publish weekly LinkedIn content on clinic supply compliance.", trust: "Collect 10 video testimonials from clinic administrators.", demand: "Outbound to Fort Worth clinic cluster with dedicated rep.", conversion: "Add volume pricing calculator to website for procurement managers.", advocacy: "Referral program: 5% credit for clinic referrals to sister locations." }),
    metrics: metrics(opportunities, recommendations, "Outpatient surgery center RFP"),
    aiSummary: "VitalMed's #1 priority is the Summit Surgical Center RFP — $180K annual, due Wednesday. MedLine stockout complaints create immediate switch opportunities ($42K). Expand wound care SKUs to stop revenue leaking to competitors on existing accounts. Total active opportunity value: $478,500.",
  };
}

function buildClearSmileDental(): Business {
  const input = clearSmileInput;
  const opportunities: Opportunity[] = [
    { id: "cs-opp-1", title: "Invisalign consult request from Google", type: "buyer", description: "High-intent Invisalign search lead submitted form 2 hours ago — no callback yet.", source: "Mock: Website form signal", estimatedValue: 6200, confidenceScore: 92, urgencyScore: 97, recommendedAction: "Call lead within 30 minutes with free consult offer", aiOutreach: "Hi {{name}} — thanks for your Invisalign inquiry at ClearSmile! We have a consult slot tomorrow at 2pm or 4pm. Which works? Reply or call us at (602) 555-0142.", status: "new" },
    { id: "cs-opp-2", title: "BrightNow Dental wait-time backlash", type: "competitor_weakness", description: "BrightNow Phoenix location has 11 recent reviews citing 45+ minute waits and rushed cleanings.", source: "Mock: Google Reviews analysis", estimatedValue: 8400, confidenceScore: 80, urgencyScore: 74, recommendedAction: "Run 'Never Rushed' Google ads targeting east Phoenix zip codes", status: "saved" },
    { id: "cs-opp-3", title: "Cosmetic dentistry package launch", type: "product", description: "Cosmetic revenue is 18% vs 35% goal. No bundled whitening + veneer consult offer.", source: "Mock: Offer performance model", estimatedValue: 11000, confidenceScore: 78, urgencyScore: 68, recommendedAction: "Launch $99 Smile Assessment including whitening preview and veneer consult", status: "in_progress" },
    { id: "cs-opp-4", title: "Dental anxiety content series", type: "content", description: "'Dentist anxiety Phoenix' searches up 45%. Your content addresses clinical topics only.", source: "Mock: Search trend signal", estimatedValue: 3800, confidenceScore: 81, urgencyScore: 55, recommendedAction: "Publish 3 'anxiety-free dentistry' blog posts and Instagram reels", aiOutreach: "Post: Nervous about the dentist? You're not alone. ClearSmile offers sedation options, noise-canceling headphones, and zero-judgment care. Book a gentle first visit →", status: "new" },
    { id: "cs-opp-5", title: "Employer dental benefits partnership", type: "partnership", description: "2 east Phoenix employers (200+ employees) lack in-network dental — open to local partnerships.", source: "Mock: Local business network", estimatedValue: 22000, confidenceScore: 66, urgencyScore: 58, recommendedAction: "Pitch employer dental plan to HR contacts at both companies", status: "new" },
    { id: "cs-opp-6", title: "Review response backlog", type: "reputation", description: "6 unanswered Google reviews including 2 detailed 5-star reviews with no thank-you response.", source: "Mock: Review monitoring", estimatedValue: 2400, confidenceScore: 90, urgencyScore: 72, recommendedAction: "Respond to all 6 reviews today with personalized messages", status: "new" },
    { id: "cs-opp-7", title: "Scottsdale border expansion", type: "geographic", description: "Scottsdale border zip 85251 has high cosmetic dentistry demand — no ad spend.", source: "Mock: Geographic demand map", estimatedValue: 7800, confidenceScore: 72, urgencyScore: 52, recommendedAction: "Run Invisalign-focused Meta ads for Scottsdale border zips", status: "new" },
    { id: "cs-opp-8", title: "Membership plan for uninsured patients", type: "pricing", description: "35% of inquiries ask about cost. No in-house membership plan for uninsured families.", source: "Mock: Competitive pricing scan", estimatedValue: 9600, confidenceScore: 77, urgencyScore: 65, recommendedAction: "Launch $29/mo ClearSmile Care membership — cleanings, X-rays, 15% off procedures", status: "new" },
    { id: "cs-opp-9", title: "Emergency dental gap on weekends", type: "market_gap", description: "Only 2 east Phoenix dentists offer Saturday emergency hours. ClearSmile is Mon–Fri only.", source: "Mock: Market scan", estimatedValue: 5400, confidenceScore: 75, urgencyScore: 60, recommendedAction: "Add 2 Saturday emergency slots/month and promote via Google Business Profile", status: "new" },
  ];
  const recommendations: Recommendation[] = [
    { id: "cs-rec-1", title: "Call Invisalign lead within 30 minutes", whyItMatters: "92% confidence, $6,200 case value. Invisalign leads go cold after 2 hours.", whatToDoNext: "Call now. Offer tomorrow consult slots. Send confirmation text.", revenuePotential: 6200, priority: "high", emailDraft: "Subject: Your ClearSmile Invisalign consult\n\nHi {{name}},\n\nThanks for reaching out! We'd love to show you what's possible with Invisalign at ClearSmile.\n\nWe have openings tomorrow at 2pm and 4pm — which works?\n\n— ClearSmile Dental Group", dmMessage: "Hi {{name}}! Saw your Invisalign inquiry — we have consult slots tomorrow. Want me to hold one for you?", adConcept: "Headline: Invisalign in Phoenix — Free Consult This Week. Sub: ClearSmile Dental. Anxiety-free. Never rushed.", landingHeadline: "Phoenix's Anxiety-Free Invisalign & Cosmetic Dentistry" },
    { id: "cs-rec-2", title: "Launch $99 Smile Assessment package", whyItMatters: "Cosmetic goal is 35% of revenue — currently 18%. Package lowers barrier to high-value cases.", whatToDoNext: "Create landing page and promote on Instagram + Google this week.", revenuePotential: 11000, priority: "high", offerIdea: "$99 Smile Assessment: whitening preview + veneer consult + digital smile mockup" },
    { id: "cs-rec-3", title: "Capture BrightNow switchers with 'Never Rushed' campaign", whyItMatters: "11 wait-time complaints = switch-ready patients in your zip code.", whatToDoNext: "Launch Google ads with 'Never Rushed' messaging in east Phoenix.", revenuePotential: 8400, priority: "medium" },
  ];
  return {
    id: "demo-clearsmile-dental", createdAt: now(), updatedAt: now(), input,
    profile: {
      companySummary: "ClearSmile Dental Group is a modern dental practice in east Phoenix doing $50K–$100K/mo. Strong clinical reputation but new patient flow dropped after a competitor opened nearby — cosmetic dentistry growth is the key path to revenue goals.",
      brandPositioning: "Phoenix's anxiety-free dental home — modern technology, never rushed, and focused on smiles you're proud of.",
      targetAudience: input.targetCustomer, productsServices: input.productsServices,
      strengths: ["4.8★ Google rating with strong cosmetic portfolio", "Invisalign Diamond provider status", "Sedation and comfort-focused patient experience"],
      weaknesses: ["New patient flow down 22% since competitor opened", "Cosmetic revenue at 18% vs 35% goal", "No weekend emergency hours"],
      marketOpportunities: ["Hot Invisalign lead waiting for callback", "BrightNow wait-time complaints in market", "Employer dental partnerships — 400+ employees", "Uninsured membership plan gap"],
      suggestedCompetitors: ["Desert Dental Care", "Smile Studio Phoenix", "BrightNow Dental"],
      brandImprovements: ["Call web leads within 15 minutes — automate SMS alert to front desk", "Launch $99 Smile Assessment to drive cosmetic conversions", "Add 2 Saturday emergency slots monthly", "Create dental anxiety content series for SEO + social"],
    },
    opportunities,
    competitors: [
      { id: "cs-comp-1", name: "Desert Dental Care", website: "https://desertdental.example", strengths: ["20-year local presence", "Insurance acceptance breadth", "Family-friendly"], weaknesses: ["Dated website", "No cosmetic focus", "Long appointment waits"], positioning: "Traditional family dentistry", pricingNotes: "Insurance-driven — cosmetic is secondary", customerComplaints: ["Office feels outdated", "Waited 40 minutes", "No cosmetic options discussed"], beatOpportunity: "Win cosmetic and Invisalign cases with modern experience vs their dated approach." },
      { id: "cs-comp-2", name: "Smile Studio Phoenix", website: "https://smilestudio.example", strengths: ["Cosmetic-focused branding", "Strong Instagram", "Invisalign provider"], weaknesses: ["4.2★ rating", "Mixed quality reviews", "Premium pricing"], positioning: "Cosmetic dentistry boutique", pricingNotes: "20–30% above market on cosmetic", customerComplaints: ["Results didn't match preview", "Felt upsold", "Poor follow-up"], beatOpportunity: "Win on trust and follow-through — same cosmetic focus, better outcomes and care." },
      { id: "cs-comp-3", name: "BrightNow Dental", website: "https://brightnow.example", strengths: ["Corporate backing", "Extended hours", "Walk-in availability"], weaknesses: ["45+ min waits (11 complaints)", "Rushed cleanings", "High staff turnover"], positioning: "Convenient corporate dental chain", pricingNotes: "Insurance-focused with promotional pricing", customerComplaints: ["Waited over an hour", "Different dentist every visit", "Felt like a factory"], beatOpportunity: "Target their frustrated patients with 'Never Rushed' positioning — convenience without the chaos." },
    ],
    recommendations,
    brandScore: score(79, 74, 84, 76, 72, 70, 81, 73, 50, { visibility: "Run Invisalign-focused ads in east Phoenix and Scottsdale border.", trust: "Respond to all 6 pending reviews today — silence erodes dental trust.", demand: "Launch $29/mo membership plan for uninsured families.", conversion: "Implement 15-minute lead callback SLA with SMS alerts.", advocacy: "Referral program: free whitening for every referred new patient." }),
    metrics: metrics(opportunities, recommendations, "Invisalign consult request from Google"),
    aiSummary: "ClearSmile has a hot Invisalign lead waiting — call within 30 minutes ($6,200 case). BrightNow's wait-time backlash opens a 'Never Rushed' displacement play. Launch the $99 Smile Assessment to accelerate cosmetic revenue toward your 35% goal. Total active opportunity value: $76,600.",
  };
}

function buildComfortZoneHVAC(): Business {
  const input = comfortZoneInput;
  const opportunities: Opportunity[] = [
    { id: "cz-opp-1", title: "AC failure cluster — heat wave inbound", type: "buyer", description: "17 emergency AC calls queued from yesterday's 98° day. 4 unbooked leads in voicemail.", source: "Mock: Call tracking signal", estimatedValue: 6800, confidenceScore: 94, urgencyScore: 99, recommendedAction: "Call 4 voicemail leads before 10am and prioritize same-day dispatch", aiOutreach: "Hi {{name}} — ComfortZone got your AC emergency call. We have a tech available today between 1–3pm. Can we lock that in?", status: "new" },
    { id: "cz-opp-2", title: "One Hour Heating hidden fee complaints", type: "competitor_weakness", description: "One Hour Heating Atlanta has 19 recent reviews mentioning surprise diagnostic fees.", source: "Mock: Google Reviews analysis", estimatedValue: 5200, confidenceScore: 82, urgencyScore: 76, recommendedAction: "Run '$0 Diagnostic Fee' Google ads in Marietta and Decatur", status: "saved" },
    { id: "cz-opp-3", title: "Maintenance plan conversion push", type: "product", description: "Only 142 maintenance subscribers vs 400 goal. 60% of repair customers aren't offered a plan.", source: "Mock: Offer performance model", estimatedValue: 36000, confidenceScore: 87, urgencyScore: 82, recommendedAction: "Train techs to offer $19/mo ComfortClub plan on every service call this week", status: "in_progress" },
    { id: "cz-opp-4", title: "Pre-season AC tune-up content", type: "content", description: "'AC tune up Atlanta' searches spike in April. No ComfortZone blog content ranks.", source: "Mock: Search trend signal", estimatedValue: 4200, confidenceScore: 78, urgencyScore: 70, recommendedAction: "Publish AC tune-up checklist blog and promote with $79 tune-up offer", aiOutreach: "Post: Atlanta heat is coming ☀️ Is your AC ready? $79 tune-up special — book before April 15 → comfortzonehvac.com/tuneup", status: "new" },
    { id: "cz-opp-5", title: "Property manager maintenance contracts", type: "partnership", description: "4 Atlanta property managers need HVAC vendors for 200+ units — no B2B outreach yet.", source: "Mock: Local business network", estimatedValue: 48000, confidenceScore: 68, urgencyScore: 55, recommendedAction: "Email 4 property managers with multi-unit maintenance proposal", status: "new" },
    { id: "cz-opp-6", title: "Review generation from happy emergency calls", type: "reputation", description: "Last week's emergency saves generated 0 reviews. Competitors convert 30% of service calls to reviews.", source: "Mock: Review monitoring", estimatedValue: 2800, confidenceScore: 85, urgencyScore: 60, recommendedAction: "Text review link to all customers served in last 7 days", status: "new" },
    { id: "cz-opp-7", title: "Marietta geographic expansion", type: "geographic", description: "Marietta 30062 has aging housing stock (avg system age 12 yrs) — no ComfortZone ad presence.", source: "Mock: Geographic demand map", estimatedValue: 6400, confidenceScore: 74, urgencyScore: 58, recommendedAction: "Launch Marietta geo-targeted ads with $79 tune-up offer", status: "new" },
    { id: "cz-opp-8", title: "Smart thermostat upsell on every install", type: "pricing", description: "Smart thermostat attach rate is 12% on installs. Ecobee bundle could add $350/job.", source: "Mock: Competitive pricing scan", estimatedValue: 5600, confidenceScore: 80, urgencyScore: 55, recommendedAction: "Bundle Ecobee install at $299 on every system replacement quote", status: "new" },
    { id: "cz-opp-9", title: "Duct cleaning add-on gap", type: "market_gap", description: "Customers ask about duct cleaning but you refer out — losing $400+ per job.", source: "Mock: Market scan", estimatedValue: 8200, confidenceScore: 76, urgencyScore: 50, recommendedAction: "Add duct cleaning service or partner with certified provider at markup", status: "new" },
  ];
  const recommendations: Recommendation[] = [
    { id: "cz-rec-1", title: "Call 4 emergency AC leads before 10am", whyItMatters: "Heat wave demand — $6,800 in emergency calls. Unbooked leads go to CoolAir within hours.", whatToDoNext: "Call voicemail leads now. Offer same-day dispatch slots.", revenuePotential: 6800, priority: "high", socialPost: "AC out in Atlanta? 🌡️ ComfortZone has same-day emergency slots. Call now — we're dispatching techs across metro Atlanta.", emailDraft: "Subject: Your AC emergency — same-day service available\n\nHi {{name}},\n\nWe received your emergency call. Our tech can be there today 1–3pm.\n\nConfirm by replying or calling (404) 555-0198.\n\n— ComfortZone HVAC", offerIdea: "Heat Wave Special: $0 diagnostic fee + same-day emergency dispatch", landingHeadline: "Atlanta's Same-Day AC Repair — $0 Diagnostic Fee" },
    { id: "cz-rec-2", title: "Convert repair customers to ComfortClub plans", whyItMatters: "258 maintenance subscribers needed to hit 400 goal. Every repair call is a conversion opportunity.", whatToDoNext: "Brief techs on $19/mo ComfortClub pitch. Track attach rate daily.", revenuePotential: 36000, priority: "high", offerIdea: "ComfortClub: $19/mo — 2 tune-ups/year, 15% off repairs, priority scheduling" },
    { id: "cz-rec-3", title: "Pitch property managers on multi-unit contracts", whyItMatters: "One property manager = 50+ units. $48K potential across 4 managers.", whatToDoNext: "Send multi-unit maintenance proposal to 4 property managers this week.", revenuePotential: 48000, priority: "medium" },
  ];
  return {
    id: "demo-comfortzone-hvac", createdAt: now(), updatedAt: now(), input,
    profile: {
      companySummary: "ComfortZone HVAC is an Atlanta residential HVAC company doing $20K–$50K/mo. Strong emergency response reputation but maintenance contract base is stuck at 142 subscribers vs 400 goal — recurring revenue is the growth bottleneck.",
      brandPositioning: "Atlanta's reliable comfort partner — same-day emergency response, transparent pricing, and maintenance plans that prevent breakdowns.",
      targetAudience: input.targetCustomer, productsServices: input.productsServices,
      strengths: ["Same-day emergency dispatch capability", "4.6★ Google rating with fast response praise", "Experienced NATE-certified technicians"],
      weaknesses: ["Only 142 maintenance subscribers vs 400 goal", "60% of repair customers not offered maintenance plan", "No property manager B2B contracts"],
      marketOpportunities: ["Heat wave emergency call backlog — $6,800 today", "One Hour Heating fee complaints — displacement play", "4 property managers with 200+ units need vendor", "Pre-season tune-up season starting — content gap"],
      suggestedCompetitors: ["CoolAir Atlanta", "Peachtree Heating & Air", "One Hour Heating"],
      brandImprovements: ["Mandate ComfortClub pitch on every service call", "Launch $0 diagnostic fee campaign vs One Hour Heating", "Build property manager B2B landing page and proposal template", "Add post-service SMS review requests within 2 hours"],
    },
    opportunities,
    competitors: [
      { id: "cz-comp-1", name: "CoolAir Atlanta", website: "https://coolairatlanta.example", strengths: ["Large fleet", "Strong Google Ads", "24/7 availability"], weaknesses: ["4.1★ rating", "Upselling complaints", "Inconsistent tech quality"], positioning: "High-volume Atlanta HVAC service", pricingNotes: "Competitive emergency pricing with upsell focus", customerComplaints: ["Tried to sell me a new system for a $50 fix", "Different tech every time", "Overcharged for parts"], beatOpportunity: "Win on honesty — 'We fix what's broken, not what's profitable.'" },
      { id: "cz-comp-2", name: "Peachtree Heating & Air", website: "https://peachtreehvac.example", strengths: ["30-year reputation", "Commercial contracts", "Maintenance plan base"], weaknesses: ["Slow emergency response", "Dated website", "Premium pricing"], positioning: "Established Atlanta HVAC institution", pricingNotes: "15–20% above market — legacy brand premium", customerComplaints: ["Took 2 days for emergency call", "Website booking doesn't work", "Expensive for what you get"], beatOpportunity: "Win emergency and residential on speed and modern booking — they're slow and old-school." },
      { id: "cz-comp-3", name: "One Hour Heating", website: "https://onehourheating.example", strengths: ["National brand trust", "On-time guarantee marketing", "Franchise support"], weaknesses: ["Surprise diagnostic fees (19 complaints)", "Franchise quality variance", "High pressure sales"], positioning: "National on-time HVAC franchise", pricingNotes: "$89 diagnostic fee often surprise — drives complaints", customerComplaints: ["$89 fee not disclosed upfront", "Pushed $8K system replacement for minor issue", "Felt like a sales call not a service call"], beatOpportunity: "Run '$0 Diagnostic Fee' campaign — directly counter their #1 complaint." },
    ],
    recommendations,
    brandScore: score(71, 69, 75, 73, 67, 64, 74, 79, 56, { visibility: "Publish pre-season tune-up content and $79 offer before April peak.", trust: "Promote $0 diagnostic fee guarantee in all ads and on homepage.", demand: "Call 4 emergency leads today — heat wave window is now.", conversion: "Mandate ComfortClub pitch — track attach rate on every ticket.", advocacy: "Text review link within 2 hours of every completed service call." }),
    metrics: metrics(opportunities, recommendations, "AC failure cluster — heat wave inbound"),
    aiSummary: "ComfortZone: 4 emergency AC leads in voicemail — call before 10am ($6,800). Heat wave demand won't last; convert every repair into a ComfortClub plan ($36K recurring potential). One Hour Heating's diagnostic fee complaints are your ad angle. Total active opportunity value: $123,300.",
  };
}

function buildLuxeRealty(): Business {
  const input = luxeRealtyInput;
  const opportunities: Opportunity[] = [
    { id: "lr-opp-1", title: "Investor buyer actively seeking duplexes", type: "buyer", description: "Repeat investor client emailed looking for Ballantyne duplexes under $450K — ready to close fast.", source: "Mock: CRM / email signal", estimatedValue: 13500, confidenceScore: 88, urgencyScore: 90, recommendedAction: "Send curated duplex list with ROI analysis within 24 hours", aiOutreach: "Hi {{name}} — pulled 4 Ballantyne duplexes matching your criteria. Best ROI is 9214 Ballantyne Commons — 8.2% cap rate. Want to tour Saturday?", status: "new" },
    { id: "lr-opp-2", title: "Compass agent poaching expired listings", type: "competitor_weakness", description: "Compass Charlotte agents targeting expired listings with aggressive commission discounts.", source: "Mock: MLS signal", estimatedValue: 9800, confidenceScore: 76, urgencyScore: 72, recommendedAction: "Outbound to 6 expired listings with free staging consultation offer", status: "saved" },
    { id: "lr-opp-3", title: "Investor niche landing page", type: "product", description: "Investor clients generate 2x commission but no dedicated investor resources exist on site.", source: "Mock: Offer performance model", estimatedValue: 22000, confidenceScore: 80, urgencyScore: 65, recommendedAction: "Build investor hub with ROI calculator, market reports, and off-market alerts", status: "in_progress" },
    { id: "lr-opp-4", title: "Charlotte market report content", type: "content", description: "Monthly market reports get 4x email open rates. You haven't published one in 3 months.", source: "Mock: Search trend signal", estimatedValue: 5400, confidenceScore: 79, urgencyScore: 55, recommendedAction: "Publish Q1 Charlotte market report and email to 800-person list", aiOutreach: "Post: Charlotte home prices up 4.2% Q1 — but Ballantyne duplexes are the hidden opportunity. Our latest market report → link", status: "new" },
    { id: "lr-opp-5", title: "Mortgage broker referral loop", type: "partnership", description: "Top Charlotte mortgage broker pre-approves 40 buyers/month with no preferred realtor partner.", source: "Mock: Local business network", estimatedValue: 18000, confidenceScore: 71, urgencyScore: 58, recommendedAction: "Propose co-marketing partnership with mortgage broker — joint buyer seminars", status: "new" },
    { id: "lr-opp-6", title: "Zillow review dependency risk", type: "reputation", description: "70% of leads come from Zillow at 30% referral fee. Diversification is urgent.", source: "Mock: Lead source analysis", estimatedValue: 8500, confidenceScore: 84, urgencyScore: 68, recommendedAction: "Launch referral program and SEO content to reduce Zillow dependency below 50%", status: "new" },
    { id: "lr-opp-7", title: "SouthPark luxury listing opportunity", type: "geographic", description: "3 SouthPark homes listed above $800K with weak photography — staging pitch opportunity.", source: "Mock: MLS geographic signal", estimatedValue: 24000, confidenceScore: 74, urgencyScore: 62, recommendedAction: "Contact 3 listing agents offering complimentary staging consultation", status: "new" },
    { id: "lr-opp-8", title: "Reduced commission investor package", type: "pricing", description: "Investors buying 3+ properties expect volume discounts. No investor pricing tier exists.", source: "Mock: Competitive pricing scan", estimatedValue: 16000, confidenceScore: 77, urgencyScore: 55, recommendedAction: "Create investor tier: 2% commission on 3+ purchases with dedicated agent", status: "new" },
    { id: "lr-opp-9", title: "Off-market deal network gap", type: "market_gap", description: "Investors ask for off-market deals weekly. No formal off-market alert system built.", source: "Mock: Market scan", estimatedValue: 12000, confidenceScore: 73, urgencyScore: 50, recommendedAction: "Build off-market email alert list and source 5 pocket listings this month", status: "new" },
  ];
  const recommendations: Recommendation[] = [
    { id: "lr-rec-1", title: "Send investor duplex list within 24 hours", whyItMatters: "Repeat buyer, 88% confidence, $13,500 commission. Fast response wins investor loyalty.", whatToDoNext: "Pull 4 Ballantyne duplexes with ROI analysis. Email by end of day.", revenuePotential: 13500, priority: "high", emailDraft: "Subject: 4 Ballantyne duplexes — ROI analysis attached\n\nHi {{name}},\n\nAttached are 4 duplexes matching your criteria. Top pick: 9214 Ballantyne Commons at 8.2% cap rate.\n\nAvailable for Saturday tour?\n\n— Luxe Realty Partners", dmMessage: "Hey {{name}} — found 4 duplexes in Ballantyne under $450K. Best ROI is 8.2% cap. Want the list?", landingHeadline: "Charlotte's Investor-First Real Estate Team — Off-Market Deals & ROI Analysis" },
    { id: "lr-rec-2", title: "Build investor hub to capture 2x commission niche", whyItMatters: "Investor clients worth 2x residential commission. No dedicated resources = lost deals.", whatToDoNext: "Launch investor landing page with ROI calculator this week.", revenuePotential: 22000, priority: "high", offerIdea: "Investor Partner Program: 2% commission on 3+ purchases + off-market alerts" },
    { id: "lr-rec-3", title: "Reduce Zillow dependency below 50%", whyItMatters: "70% of leads from Zillow at 30% fee — margins eroding. Referral + SEO diversification urgent.", whatToDoNext: "Launch client referral program ($500 gift card) and publish market report.", revenuePotential: 8500, priority: "medium" },
  ];
  return {
    id: "demo-luxe-realty", createdAt: now(), updatedAt: now(), input,
    profile: {
      companySummary: "Luxe Realty Partners is a Charlotte brokerage doing $50K–$100K/mo focused on SouthPark and Ballantyne markets. Strong luxury listing experience but over-dependent on Zillow leads and underdeveloped investor niche.",
      brandPositioning: "Charlotte's investor-savvy luxury team — off-market access, ROI analysis, and staging expertise for move-up buyers and portfolio builders.",
      targetAudience: input.targetCustomer, productsServices: input.productsServices,
      strengths: ["Strong Ballantyne and SouthPark market knowledge", "Staging consultation differentiator", "Repeat investor client base"],
      weaknesses: ["70% of leads from Zillow at 30% referral fee", "No investor-specific landing page or tools", "Market report content stale — 3 months old"],
      marketOpportunities: ["Active investor buyer seeking duplexes — $13.5K commission", "Compass expired listing poaching — staging pitch angle", "Mortgage broker partnership — 40 pre-approved buyers/month", "SouthPark luxury listings with weak photography"],
      suggestedCompetitors: ["Allen Tate", "Helen Adams Realty", "Compass Charlotte"],
      brandImprovements: ["Build investor hub with ROI calculator and off-market alerts", "Launch referral program to reduce Zillow dependency", "Publish monthly Charlotte market report", "Create investor pricing tier at 2% for 3+ purchases"],
    },
    opportunities,
    competitors: [
      { id: "lr-comp-1", name: "Allen Tate", website: "https://allentate.example", strengths: ["Largest Charlotte brokerage", "Strong brand recognition", "Agent network"], weaknesses: ["Generic service", "Slow on investor deals", "Traditional marketing"], positioning: "Charlotte's largest full-service brokerage", pricingNotes: "Standard 3% listing commission", customerComplaints: ["Agent seemed inexperienced", "No investor expertise", "Felt like a number"], beatOpportunity: "Win investors and luxury sellers with specialized expertise — they're a volume shop." },
      { id: "lr-comp-2", name: "Helen Adams Realty", website: "https://helenadams.example", strengths: ["Luxury market leader", "Premium branding", "High-end clientele"], weaknesses: ["Luxury-only focus", "No investor services", "Premium commission"], positioning: "Charlotte's premier luxury real estate firm", pricingNotes: "Premium positioning — targets $1M+ exclusively", customerComplaints: ["Not interested in sub-$800K listings", "Slow to respond on investor inquiries"], beatOpportunity: "Capture mid-luxury and investor segment they ignore — $450K–$800K sweet spot." },
      { id: "lr-comp-3", name: "Compass Charlotte", website: "https://compassclt.example", strengths: ["Tech-forward platform", "Aggressive agent recruitment", "Marketing budget"], weaknesses: ["Agent turnover", "Discount commission poaching", "Less local expertise"], positioning: "Tech-enabled modern brokerage", pricingNotes: "Agents offering discounted commissions to win listings", customerComplaints: ["Agent left mid-transaction", "Felt transactional", "Promised off-market deals that never came"], beatOpportunity: "Win on stability and local expertise — 'Same agent, same commitment, from search to close.'" },
    ],
    recommendations,
    brandScore: score(73, 70, 77, 71, 69, 66, 75, 74, 52, { visibility: "Publish monthly Charlotte market report — 4x email engagement.", trust: "Showcase investor ROI case studies on website and social.", demand: "Send duplex list to active investor buyer today.", conversion: "Build investor hub with ROI calculator and off-market signup.", advocacy: "Referral program: $500 gift card for every closed referral." }),
    metrics: metrics(opportunities, recommendations, "Investor buyer actively seeking duplexes"),
    aiSummary: "Luxe Realty: your investor client wants Ballantyne duplexes — send ROI analysis today ($13,500 commission). Build the investor hub this week to capture 2x commission niche ($22K potential). Zillow dependency at 70% is a margin risk — launch referral program now. Total active opportunity value: $138,200.",
  };
}

function buildApexRoofing(): Business {
  const input = apexRoofingInput;
  const opportunities: Opportunity[] = [
    {
      id: "apex-opp-1",
      title: "Hail-damage buyer cluster in Cedar Park",
      type: "buyer",
      description:
        "12 homeowners posted in a local Facebook group asking for roof inspections after last week's hailstorm. Most haven't booked yet.",
      source: "Mock: Reddit / local forum intent",
      estimatedValue: 8400,
      confidenceScore: 88,
      urgencyScore: 94,
      recommendedAction: "Post a storm-response offer and DM the 3 most active commenters today",
      aiOutreach:
        "Hi — saw your post about hail damage in Cedar Park. Apex Roofing offers free same-week inspections with photo reports for insurance. We helped 40+ Austin homeowners this season. Want me to hold a slot for you?",
      status: "new",
    },
    {
      id: "apex-opp-2",
      title: "Lone Star Roofing slow response window",
      type: "competitor_weakness",
      description:
        "Lone Star Roofing has 14 recent Google reviews mentioning 5+ day response times. Buyers are frustrated and shopping around.",
      source: "Mock: Google Reviews analysis",
      estimatedValue: 6200,
      confidenceScore: 82,
      urgencyScore: 78,
      recommendedAction: "Launch a '48-hour estimate guarantee' landing page and run geo ads",
      aiOutreach:
        "Ad headline: Hail damage? Get your roof estimate in 48 hours — not next week. Apex Roofing | Austin's fastest storm response team.",
      status: "saved",
    },
    {
      id: "apex-opp-3",
      title: "Underserved gutter upsell on every inspection",
      type: "product",
      description:
        "Your inspection data shows 60% of roofs need gutter work, but only 12% of jobs include gutters. That's $2K+ per job left on the table.",
      source: "Mock: Offer performance model",
      estimatedValue: 5600,
      confidenceScore: 79,
      urgencyScore: 65,
      recommendedAction: "Bundle gutter inspection into every quote with a $200 same-day install discount",
      status: "in_progress",
    },
    {
      id: "apex-opp-4",
      title: "Insurance claim content gap",
      type: "content",
      description:
        "Searches for 'Austin hail roof insurance claim' spiked 340% this month. You have no content ranking for this.",
      source: "Mock: Search trend signal",
      estimatedValue: 4800,
      confidenceScore: 76,
      urgencyScore: 72,
      recommendedAction: "Publish a 'Hail Damage Insurance Guide for Austin Homeowners' blog + video",
      aiOutreach:
        "Post: Just helped another Austin homeowner navigate their hail claim. Here are the 5 photos your adjuster actually needs 📸 [link to guide]",
      status: "new",
    },
    {
      id: "apex-opp-5",
      title: "Real estate agent referral partnership",
      type: "partnership",
      description:
        "3 top Austin realtors post weekly about pre-listing repairs. None have a preferred roofing partner listed.",
      source: "Mock: Local business network",
      estimatedValue: 7200,
      confidenceScore: 71,
      urgencyScore: 58,
      recommendedAction: "Email 10 agents with a pre-listing inspection offer and co-branded one-pager",
      aiOutreach:
        "Hi {{name}} — I noticed you often help sellers prep homes. Apex Roofing offers free pre-listing roof certs with 48hr turnaround. Happy to be your go-to for listings in {{area}}.",
      status: "new",
    },
    {
      id: "apex-opp-6",
      title: "Review velocity opportunity",
      type: "reputation",
      description:
        "You're at 4.6 stars with 38 reviews. Lone Star has 4.2 with 112 reviews. Volume gap hurts local pack ranking.",
      source: "Mock: Review monitoring",
      estimatedValue: 3900,
      confidenceScore: 85,
      urgencyScore: 60,
      recommendedAction: "Text last 20 completed jobs a review link with a $25 referral bonus",
      status: "saved",
    },
    {
      id: "apex-opp-7",
      title: "Round Rock geographic expansion",
      type: "geographic",
      description:
        "Search demand in Round Rock exceeds supply. No Apex-branded presence in GBP or ads for that zip cluster.",
      source: "Mock: Geographic demand map",
      estimatedValue: 5100,
      confidenceScore: 74,
      urgencyScore: 55,
      recommendedAction: "Create Round Rock GBP location page and run $500/mo geo ads for 30 days",
      status: "new",
    },
    {
      id: "apex-opp-8",
      title: "Starter repair package vs. full replacement",
      type: "pricing",
      description:
        "Price-sensitive leads drop off when only full replacement is quoted. A 'Repair First' tier could capture them.",
      source: "Mock: Competitive pricing scan",
      estimatedValue: 4400,
      confidenceScore: 77,
      urgencyScore: 62,
      recommendedAction: "Test a $499 repair assessment package with credit toward full replacement",
      status: "new",
    },
    {
      id: "apex-opp-9",
      title: "Commercial flat-roof niche",
      type: "market_gap",
      description:
        "Local property managers struggle to find reliable flat-roof contractors. Zero competition in this sub-niche locally.",
      source: "Mock: Market scan",
      estimatedValue: 9800,
      confidenceScore: 68,
      urgencyScore: 50,
      recommendedAction: "Build a commercial landing page and outreach to 15 property managers",
      status: "new",
    },
  ];

  const recommendations: Recommendation[] = [
    {
      id: "apex-rec-1",
      title: "Capture the Cedar Park hail cluster today",
      whyItMatters:
        "Storm buyers convert within 72 hours. Waiting means they book Lone Star or Texas Top. $8,400 estimated value at 88% confidence.",
      whatToDoNext: "Post storm offer in the Facebook group and DM top 3 commenters before 5pm.",
      revenuePotential: 8400,
      priority: "high",
      socialPost:
        "🌩️ Hail hit Cedar Park hard. Apex Roofing is doing FREE same-week inspections with insurance-ready photo reports. Book before slots fill → apexroofingco.com/storm",
      emailDraft:
        "Subject: Free hail inspection — Cedar Park homeowners\n\nHi {{name}},\n\nIf your roof took hail this week, don't wait for leaks. We're offering free inspections with same-week scheduling for Cedar Park residents.\n\n— Apex Roofing Team",
      dmMessage:
        "Hey {{name}} — saw your hail damage post. We do free inspections in Cedar Park with 48hr reports for insurance. Want me to save you a slot this week?",
      adConcept:
        "Headline: Hail Damage in Austin? Free Inspection This Week. Sub: Insurance-ready reports. 48-hour estimates. 4.6★ rated.",
      offerIdea: "Storm Response Package: Free inspection + $500 off replacement if booked within 14 days",
      landingHeadline: "Austin's Fastest Storm Response Team — Free Hail Inspection This Week",
    },
    {
      id: "apex-rec-2",
      title: "Flip Lone Star's slow response into your advantage",
      whyItMatters: "Competitor weakness opportunities have a 2-week window before they fix their ops.",
      whatToDoNext: "Launch 48-hour estimate guarantee page and run $300 in geo-targeted ads.",
      revenuePotential: 6200,
      priority: "high",
      socialPost:
        "Tired of waiting a week for a roofing estimate? Apex Roofing guarantees yours in 48 hours. DM 'FAST' to book.",
      adConcept: "Headline: Your Roof Estimate in 48 Hours — Guaranteed.",
    },
    {
      id: "apex-rec-3",
      title: "Bundle gutters on every job this month",
      whyItMatters: "Highest-margin upsell with zero new lead cost — pure revenue from existing inspections.",
      whatToDoNext: "Update quote template to include gutter assessment line item by Monday.",
      revenuePotential: 5600,
      priority: "medium",
      offerIdea: "$200 off gutter install when bundled with any roof job booked this month",
    },
  ];

  return {
    id: "demo-apex-roofing",
    createdAt: now(),
    updatedAt: now(),
    input,
    profile: {
      companySummary:
        "Apex Roofing Co. is Austin's storm-response specialist, doing $20K–$50K/mo in residential roof replacement, repair, and gutter work. Strong reputation (4.6★) but seasonal lead dips and competitor price pressure limit growth toward the $80K/mo goal.",
      brandPositioning:
        "The fast, trustworthy roofing partner for Austin homeowners — especially after hail events. Not the cheapest, but the fastest to respond with insurance-ready documentation.",
      targetAudience: input.targetCustomer,
      productsServices: input.productsServices,
      strengths: [
        "4.6★ Google rating with strong storm-season track record",
        "Free inspections with insurance-ready photo documentation",
        "Experienced crew handling replacement + gutters in one visit",
      ],
      weaknesses: [
        "Seasonal lead volatility — slow months hit hard",
        "Review volume (38) trails competitors with 100+ reviews",
        "No commercial or Round Rock geographic presence yet",
      ],
      marketOpportunities: [
        "Post-hail buyer clusters convert within 72 hours",
        "Competitor response-time complaints create displacement openings",
        "Gutter upsell on existing inspections — zero acquisition cost",
        "Commercial flat-roof niche is wide open locally",
      ],
      suggestedCompetitors: ["Lone Star Roofing", "Texas Top Roof", "Summit Exteriors"],
      brandImprovements: [
        "Add storm-season urgency messaging above the fold on homepage",
        "Publish hail insurance claim guide to capture search demand",
        "Launch automated review requests after every completed job",
        "Create Round Rock GBP listing and geo-targeted ad set",
      ],
    },
    opportunities,
    competitors: [
      {
        id: "apex-comp-1",
        name: "Lone Star Roofing",
        website: "https://lonestarroofing.example",
        strengths: ["112 Google reviews", "Strong brand recognition", "Insurance claim expertise"],
        weaknesses: ["5+ day response times (14 recent complaints)", "Generic messaging", "Higher pricing with slow delivery"],
        positioning: "Established full-service roofer for Austin metro",
        pricingNotes: "Premium pricing, 2–3 week install timelines",
        customerComplaints: ["Took 6 days to return my call", "Crew left nails in driveway", "Final price was 20% over estimate"],
        beatOpportunity: "Win on speed — 48-hour estimates and same-week inspections while they take a week to respond.",
      },
      {
        id: "apex-comp-2",
        name: "Texas Top Roof",
        website: "https://texastoproof.example",
        strengths: ["Aggressive pricing", "Heavy Google Ads spend", "Large crew capacity"],
        weaknesses: ["3.8★ rating", "Quality inconsistency complaints", "No gutter services"],
        positioning: "Budget-friendly volume roofer",
        pricingNotes: "15–20% below market, uses sub-contractors",
        customerComplaints: ["Roof leaked 2 months after install", "Hard to reach after payment", "Sloppy cleanup"],
        beatOpportunity: "Position as the quality alternative — 'You get what you pay for' messaging with warranty emphasis.",
      },
      {
        id: "apex-comp-3",
        name: "Summit Exteriors",
        website: "https://summitexteriors.example",
        strengths: ["Beautiful website", "Strong social media", "Serves commercial + residential"],
        weaknesses: ["Minimal reviews (22)", "No storm-response messaging", "Slow content production"],
        positioning: "Premium exterior renovation company",
        pricingNotes: "High-end pricing, long sales cycle",
        customerComplaints: ["Took 3 weeks to schedule", "Over-engineered quotes"],
        beatOpportunity: "Out-execute on storm urgency — they're positioned for planned projects, not emergency response.",
      },
    ],
    recommendations,
    brandScore: score(72, 68, 74, 71, 69, 65, 76, 81, 58, {
      visibility: "Boost local SEO with storm-season content and Round Rock GBP listing.",
      trust: "Push review count from 38 to 75+ with post-job SMS requests.",
      demand: "Run geo-targeted hail-response ads in Cedar Park and Round Rock.",
      conversion: "Add 48-hour estimate guarantee above the fold on homepage.",
      advocacy: "Launch $25 referral bonus for every new customer referred by past clients.",
    }),
    metrics: metrics(opportunities, recommendations, "Hail-damage buyer cluster in Cedar Park"),
    aiSummary:
      "Apex Roofing is sitting on a hot storm-response window. 12 Cedar Park homeowners are actively seeking inspections — that's your #1 play today ($8,400 potential). Lone Star's slow response times give you a 2-week displacement window. Focus this week on: (1) storm cluster outreach, (2) 48-hour guarantee launch, (3) gutter upsell on every inspection. Total active opportunity value: $56,400.",
  };
}

function buildGlowStudio(): Business {
  const input = glowStudioInput;
  const opportunities: Opportunity[] = [
    {
      id: "glow-opp-1",
      title: "Botox membership churn recovery",
      type: "buyer",
      description:
        "47 clients haven't rebook Botox in 90+ days. Average LTV per returning client is $2,800/yr.",
      source: "Mock: CRM reactivation signal",
      estimatedValue: 11200,
      confidenceScore: 84,
      urgencyScore: 88,
      recommendedAction: "Send personalized 'We miss you' SMS with 15% off next treatment this week",
      aiOutreach:
        "Hi {{name}}! It's been a while since your last visit at Glow Studio 💫 Your Botox results typically last 3–4 months — we'd love to see you! Book this week and enjoy 15% off. Reply YES to schedule.",
      status: "new",
    },
    {
      id: "glow-opp-2",
      title: "SkinLab's outdated booking UX",
      type: "competitor_weakness",
      description:
        "SkinLab Miami's online booking requires phone confirmation, causing 30%+ drop-off. Reviews mention frustration.",
      source: "Mock: Google Reviews analysis",
      estimatedValue: 7800,
      confidenceScore: 80,
      urgencyScore: 75,
      recommendedAction: "Run ads highlighting 'Book online in 60 seconds' with direct Calendly link",
      status: "saved",
    },
    {
      id: "glow-opp-3",
      title: "HydraFacial + Botox combo gap",
      type: "market_gap",
      description:
        "No Miami med spa offers a bundled 'Red Carpet Ready' package. Search volume for combo treatments is rising.",
      source: "Mock: Market scan",
      estimatedValue: 6500,
      confidenceScore: 77,
      urgencyScore: 70,
      recommendedAction: "Create $499 'Red Carpet Ready' bundle and promote on Instagram Reels",
      aiOutreach:
        "✨ NEW: Red Carpet Ready Package — HydraFacial + Botox touch-up for $499 (save $150). Limited slots this month. Link in bio.",
      status: "new",
    },
    {
      id: "glow-opp-4",
      title: "Influencer micro-partnership",
      type: "partnership",
      description:
        "5 Miami micro-influencers (10K–50K followers) posted about med spa experiences last month without tagging a provider.",
      source: "Mock: Instagram signal",
      estimatedValue: 5400,
      confidenceScore: 72,
      urgencyScore: 65,
      recommendedAction: "DM 5 influencers with complimentary treatment offer for honest review",
      status: "new",
    },
    {
      id: "glow-opp-5",
      title: "Google review sentiment shift",
      type: "reputation",
      description:
        "3 recent reviews mention wait times. Your 4.8★ rating is strong but one more complaint could trigger a trend.",
      source: "Mock: Review monitoring",
      estimatedValue: 3200,
      confidenceScore: 86,
      urgencyScore: 80,
      recommendedAction: "Implement text-based check-in updates and respond to all 3 reviews today",
      status: "in_progress",
    },
    {
      id: "glow-opp-6",
      title: "Bridal party package opportunity",
      type: "product",
      description:
        "Wedding season peaks in Q1 Miami. No bridal-specific package exists despite 8 inquiries last month.",
      source: "Mock: Offer performance model",
      estimatedValue: 8900,
      confidenceScore: 75,
      urgencyScore: 85,
      recommendedAction: "Launch 'Bridal Glow Package' for parties of 4+ with group discount",
      status: "new",
    },
    {
      id: "glow-opp-7",
      title: "Coral Gables geographic gap",
      type: "geographic",
      description:
        "High-income zip 33156 has zero Glow Studio ad presence. Med spa search volume is 2x your current target area.",
      source: "Mock: Geographic demand map",
      estimatedValue: 6100,
      confidenceScore: 70,
      urgencyScore: 55,
      recommendedAction: "Run Instagram geo-targeted ads for Coral Gables and Coconut Grove",
      status: "new",
    },
    {
      id: "glow-opp-8",
      title: "Membership tier pricing test",
      type: "pricing",
      description:
        "Current membership is all-or-nothing at $299/mo. A $149 'Essentials' tier could capture price-sensitive clients.",
      source: "Mock: Competitive pricing scan",
      estimatedValue: 4800,
      confidenceScore: 73,
      urgencyScore: 60,
      recommendedAction: "A/B test Essentials tier with 20 existing leads who didn't convert",
      status: "new",
    },
    {
      id: "glow-opp-9",
      title: "Before/after content series",
      type: "content",
      description:
        "Your Instagram has 2.1K followers but only 3 before/after posts. Competitors post weekly transformations.",
      source: "Mock: Search trend signal",
      estimatedValue: 3600,
      confidenceScore: 81,
      urgencyScore: 58,
      recommendedAction: "Film 4 client transformations this week with consent forms ready",
      status: "saved",
    },
  ];

  const recommendations: Recommendation[] = [
    {
      id: "glow-rec-1",
      title: "Reactivate 47 lapsed Botox clients",
      whyItMatters: "Reactivation is 5x cheaper than new acquisition. $11,200 potential from clients who already trust you.",
      whatToDoNext: "Send SMS blast with 15% offer today. Follow up non-responders in 48 hours.",
      revenuePotential: 11200,
      priority: "high",
      socialPost:
        "Missing that Glow? ✨ Our Botox clients typically rebook every 3–4 months. Book this week → 15% off your treatment. DM 'GLOW' to schedule.",
      emailDraft:
        "Subject: We miss seeing you at Glow Studio 💫\n\nHi {{name}},\n\nIt's been a few months since your last visit. Your results were looking amazing — ready for a refresh?\n\nBook this week and enjoy 15% off any treatment.\n\n— The Glow Studio Team",
      dmMessage: "Hey {{name}}! Ready for your Botox refresh? 15% off this week only — want me to hold a slot?",
      adConcept: "Headline: Your Glow Deserves a Refresh. Sub: Book Botox online in 60 seconds. Miami's top-rated med spa.",
      offerIdea: "Glow Refresh Week: 15% off any treatment for returning clients",
      landingHeadline: "Miami's Most Trusted Med Spa — Book Your Treatment in 60 Seconds",
    },
    {
      id: "glow-rec-2",
      title: "Launch Bridal Glow Package before wedding season",
      whyItMatters: "8 inquiries with no package = lost revenue. Bridal parties average $3,500 per booking.",
      whatToDoNext: "Create package pricing page and share in 3 local wedding Facebook groups.",
      revenuePotential: 8900,
      priority: "high",
      offerIdea: "Bridal Glow Package: HydraFacial + Botox for bride + 20% off for party of 4+",
    },
    {
      id: "glow-rec-3",
      title: "Fix wait-time perception before it hurts ratings",
      whyItMatters: "One review trend can drop you from 4.8 to 4.5 — that's a 15% booking drop in med spa.",
      whatToDoNext: "Add SMS check-in updates and respond to all 3 recent wait-time reviews today.",
      revenuePotential: 3200,
      priority: "medium",
    },
  ];

  return {
    id: "demo-glow-studio",
    createdAt: now(),
    updatedAt: now(),
    input,
    profile: {
      companySummary:
        "Glow Studio Med Spa is a premium aesthetic clinic in Miami doing $50K–$100K/mo. Strong 4.8★ rating and loyal clientele, but high ad costs and client retention gaps limit path to $150K/mo and a second location.",
      brandPositioning:
        "Miami's trusted boutique med spa — premium results without the clinical feel. Where busy women get expert care on their schedule.",
      targetAudience: input.targetCustomer,
      productsServices: input.productsServices,
      strengths: [
        "4.8★ Google rating — top 3 in Miami med spa category",
        "Strong Botox and HydraFacial expertise with repeat clientele",
        "Beautiful studio aesthetic that drives Instagram engagement",
      ],
      weaknesses: [
        "Client rebooking rate drops after 90 days — no automated follow-up",
        "High CAC ($180+) eating into margins on new client acquisition",
        "Limited content — only 3 before/after posts despite strong results",
      ],
      marketOpportunities: [
        "47 lapsed Botox clients ready for reactivation outreach",
        "Bridal party packages untapped during peak wedding season",
        "Coral Gables high-income zip has zero ad presence",
        "Competitor booking UX frustration drives switch-ready clients",
      ],
      suggestedCompetitors: ["SkinLab Miami", "Radiance Aesthetics", "Bella Med Spa"],
      brandImprovements: [
        "Automate 90-day rebooking SMS sequences for all treatment types",
        "Launch weekly before/after content series on Instagram Reels",
        "Create tiered membership (Essentials $149 + Premium $299)",
        "Add online booking CTA to every ad and social post",
      ],
    },
    opportunities,
    competitors: [
      {
        id: "glow-comp-1",
        name: "SkinLab Miami",
        website: "https://skinlabmiami.example",
        strengths: ["2 locations", "Heavy Meta ad spend", "Wide treatment menu"],
        weaknesses: ["Booking requires phone confirmation", "3.9★ rating", "Generic brand feel"],
        positioning: "Volume med spa with broad treatment offerings",
        pricingNotes: "Frequent Groupon deals — trains clients to wait for discounts",
        customerComplaints: ["Couldn't book online", "Felt rushed during treatment", "Upsold aggressively"],
        beatOpportunity: "Win on convenience — instant online booking and no-pressure consultations.",
      },
      {
        id: "glow-comp-2",
        name: "Radiance Aesthetics",
        website: "https://radianceaesthetics.example",
        strengths: ["Luxury branding", "Celebrity clientele", "High-end pricing power"],
        weaknesses: ["Limited availability", "No membership program", "Weak social presence"],
        positioning: "Ultra-premium aesthetic clinic for elite clients",
        pricingNotes: "30–40% above market — limits addressable audience",
        customerComplaints: ["3-month wait for appointment", "No follow-up after treatment"],
        beatOpportunity: "Capture mid-premium segment — luxury feel at accessible price with better availability.",
      },
      {
        id: "glow-comp-3",
        name: "Bella Med Spa",
        website: "https://bellamedspa.example",
        strengths: ["Strong TikTok presence", "Young demographic", "Aggressive promo calendar"],
        weaknesses: ["Inconsistent results (3.7★)", "High staff turnover", "No medical director on site"],
        positioning: "Trendy, social-media-driven med spa for younger clients",
        pricingNotes: "Low entry prices, heavy upselling during appointments",
        customerComplaints: ["Different person every visit", "Results didn't last", "Felt like a sales pitch"],
        beatOpportunity: "Win on consistency and trust — same provider, medical oversight, proven results.",
      },
    ],
    recommendations,
    brandScore: score(81, 76, 85, 79, 74, 72, 83, 77, 52, {
      visibility: "Increase Instagram Reels frequency to 4x/week with before/after content.",
      trust: "Respond to all reviews within 24 hours and highlight medical credentials.",
      demand: "Launch Coral Gables geo-targeted ad campaign for high-income zip codes.",
      conversion: "Promote instant online booking in every ad — competitors require phone calls.",
      advocacy: "Create referral program: $50 credit for every friend who books.",
    }),
    metrics: metrics(opportunities, recommendations, "Botox membership churn recovery"),
    aiSummary:
      "Glow Studio's biggest lever this week is reactivation — 47 lapsed Botox clients represent $11,200 in near-certain revenue. Wedding season is peaking, so launch the Bridal Glow Package before competitors fill that slot. Your 4.8★ rating is an asset — protect it by fixing wait-time perception now. Total active opportunity value: $58,500.",
  };
}

function buildStackline(): Business {
  const input = stacklineInput;
  const opportunities: Opportunity[] = [
    {
      id: "stack-opp-1",
      title: "Ops leader actively comparing automation tools",
      type: "buyer",
      description:
        "A VP of Ops at a 85-person logistics company posted on LinkedIn asking for Zapier alternatives with better team features.",
      source: "Mock: LinkedIn intent signal",
      estimatedValue: 9600,
      confidenceScore: 86,
      urgencyScore: 92,
      recommendedAction: "Comment with value-first reply and DM a personalized 15-min demo link",
      aiOutreach:
        "Hi {{name}} — saw your post about outgrowing Zapier. Stackline was built specifically for ops teams at 20–200 person companies. Happy to show you how {{company}} could automate {{pain_point}} in a 15-min call. No pitch deck, just your workflows.",
      status: "new",
    },
    {
      id: "stack-opp-2",
      title: "Zapier pricing frustration trend",
      type: "competitor_weakness",
      description:
        "Reddit r/SaaS thread with 47 upvotes complaining about Zapier task limits. Multiple commenters seeking alternatives.",
      source: "Mock: Reddit intent",
      estimatedValue: 7200,
      confidenceScore: 78,
      urgencyScore: 80,
      recommendedAction: "Publish 'Stackline vs Zapier' comparison page and share in thread",
      status: "saved",
    },
    {
      id: "stack-opp-3",
      title: "Onboarding concierge as differentiator",
      type: "product",
      description:
        "Demo-to-close rate is 12%. Prospects who get onboarding concierge convert at 34%. Only 20% of demos include it.",
      source: "Mock: Offer performance model",
      estimatedValue: 8400,
      confidenceScore: 88,
      urgencyScore: 85,
      recommendedAction: "Make onboarding concierge default for all demos starting next week",
      status: "in_progress",
    },
    {
      id: "stack-opp-4",
      title: "'Manual process audit' lead magnet",
      type: "content",
      description:
        "Ops automation content gets 3x engagement on LinkedIn vs product posts. No lead magnet exists yet.",
      source: "Mock: Search trend signal",
      estimatedValue: 5100,
      confidenceScore: 74,
      urgencyScore: 60,
      recommendedAction: "Create free 'Ops Automation Scorecard' PDF and promote via LinkedIn post",
      aiOutreach:
        "Post: Most ops teams waste 15+ hours/week on manual processes. We built a free scorecard to find yours → [link]",
      status: "new",
    },
    {
      id: "stack-opp-5",
      title: "Integration partner co-marketing",
      type: "partnership",
      description:
        "Notion and Airtable partner directories accept automation tool listings. Stackline isn't listed on either.",
      source: "Mock: Partnership directory",
      estimatedValue: 6800,
      confidenceScore: 70,
      urgencyScore: 55,
      recommendedAction: "Apply to Notion and Airtable partner programs this week",
      status: "new",
    },
    {
      id: "stack-opp-6",
      title: "G2 review gap hurting enterprise deals",
      type: "reputation",
      description:
        "Make.com has 450+ G2 reviews. Stackline has 12. Enterprise prospects check G2 before demo requests.",
      source: "Mock: Review monitoring",
      estimatedValue: 4200,
      confidenceScore: 82,
      urgencyScore: 70,
      recommendedAction: "Email 15 happiest customers asking for G2 review with $25 Amazon gift card",
      status: "new",
    },
    {
      id: "stack-opp-7",
      title: "Agency reseller channel",
      type: "geographic",
      description:
        "12 ops consulting agencies serve your ICP but have no automation tool partnership. Channel play is untapped.",
      source: "Mock: Market scan",
      estimatedValue: 15000,
      confidenceScore: 65,
      urgencyScore: 45,
      recommendedAction: "Build agency partner page with 20% rev share and outreach to 5 agencies",
      status: "new",
    },
    {
      id: "stack-opp-8",
      title: "Annual billing conversion",
      type: "pricing",
      description:
        "Only 8% of customers choose annual billing. A limited-time 2-months-free offer could shift 30% to annual.",
      source: "Mock: Competitive pricing scan",
      estimatedValue: 5400,
      confidenceScore: 76,
      urgencyScore: 50,
      recommendedAction: "Email all monthly customers with annual upgrade offer (2 months free)",
      status: "new",
    },
    {
      id: "stack-opp-9",
      title: "Vertical workflow templates",
      type: "market_gap",
      description:
        "Prospects ask 'Does this work for {{industry}}?' No vertical-specific templates exist for logistics, healthcare, or agencies.",
      source: "Mock: Market scan",
      estimatedValue: 7800,
      confidenceScore: 72,
      urgencyScore: 58,
      recommendedAction: "Build 3 vertical template packs (logistics, agencies, healthcare) as free downloads",
      status: "new",
    },
  ];

  const recommendations: Recommendation[] = [
    {
      id: "stack-rec-1",
      title: "Close the LinkedIn ops leader today",
      whyItMatters: "Active buyer comparing tools right now. $9,600 ACV potential at 86% confidence. Window closes in days.",
      whatToDoNext: "Comment on their post with value, then DM personalized demo link within 2 hours.",
      revenuePotential: 9600,
      priority: "high",
      socialPost:
        "Ops teams at 50–200 person companies: if you're outgrowing Zapier, you're not alone. We built Stackline for exactly this. Free automation scorecard → stackline.io/scorecard",
      emailDraft:
        "Subject: Re: your automation question\n\nHi {{name}},\n\nSaw your LinkedIn post about outgrowing Zapier. Happy to show you how teams like {{similar_company}} automated {{workflow}} in under a week.\n\n15-min call, no deck — just your workflows.\n\n— {{founder_name}}, Stackline",
      dmMessage:
        "Hey {{name}} — saw your post about Zapier alternatives. Stackline is built for ops teams your size. Worth a 15-min walkthrough of your specific workflows?",
      adConcept: "Headline: Outgrown Zapier? Stackline Built for Ops Teams. Sub: Free concierge onboarding. No task limits.",
      offerIdea: "Launch offer: Free onboarding concierge + 2 months free on annual plans",
      landingHeadline: "The Automation Platform Built for Ops Teams Who Outgrew Zapier",
    },
    {
      id: "stack-rec-2",
      title: "Make onboarding concierge mandatory on every demo",
      whyItMatters: "34% close rate with concierge vs 12% without — that's nearly 3x conversion on existing pipeline.",
      whatToDoNext: "Update demo booking flow to include concierge opt-in by default.",
      revenuePotential: 8400,
      priority: "high",
    },
    {
      id: "stack-rec-3",
      title: "Publish Stackline vs Zapier comparison page",
      whyItMatters: "Active Reddit thread with switch-ready buyers. Comparison pages convert at 8–12% for SaaS.",
      whatToDoNext: "Write comparison page tonight and share link in Reddit thread + LinkedIn.",
      revenuePotential: 7200,
      priority: "medium",
      landingHeadline: "Stackline vs Zapier: Built for Teams, Not Just Tasks",
    },
  ];

  return {
    id: "demo-stackline",
    createdAt: now(),
    updatedAt: now(),
    input,
    profile: {
      companySummary:
        "Stackline is a B2B workflow automation SaaS at $5K–$20K/mo MRR, targeting ops teams at 20–200 person companies. Product-market fit signals are strong (34% close with concierge) but demo volume and conversion optimization are the bottlenecks to $50K MRR.",
      brandPositioning:
        "The automation platform built for ops teams who outgrew Zapier — with concierge onboarding, no task limits, and team-first workflows.",
      targetAudience: input.targetCustomer,
      productsServices: input.productsServices,
      strengths: [
        "34% demo-to-close rate with onboarding concierge",
        "Clear differentiation from Zapier on team features and pricing",
        "Strong product feedback from early customers (NPS 62)",
      ],
      weaknesses: [
        "Only 12 G2 reviews — enterprise prospects hesitate",
        "Demo-to-close without concierge is 12% — leaky funnel",
        "No vertical-specific templates or case studies yet",
      ],
      marketOpportunities: [
        "Active LinkedIn buyer comparing automation tools right now",
        "Zapier pricing backlash creating switch-ready audience",
        "Agency reseller channel completely untapped",
        "Vertical workflow templates would answer top demo objection",
      ],
      suggestedCompetitors: ["Zapier", "Make", "Monday.com"],
      brandImprovements: [
        "Make onboarding concierge default on every demo booking",
        "Publish 3 vertical case studies (logistics, agency, healthcare)",
        "Launch G2 review campaign targeting 50 reviews in 60 days",
        "Build comparison pages for Zapier, Make, and Monday.com",
      ],
    },
    opportunities,
    competitors: [
      {
        id: "stack-comp-1",
        name: "Zapier",
        website: "https://zapier.com",
        strengths: ["5,000+ integrations", "Massive brand recognition", "450+ G2 reviews"],
        weaknesses: ["Task-based pricing frustrates growing teams", "No team collaboration features", "Complex pricing at scale"],
        positioning: "The default automation tool for individuals and small teams",
        pricingNotes: "Task limits create unpredictable bills — $500+/mo common at 50+ person companies",
        customerComplaints: ["Hit task limits mid-month", "No way to share workflows with team", "Pricing doubled in 2 years"],
        beatOpportunity: "Target their frustrated mid-market customers with unlimited tasks and team features.",
      },
      {
        id: "stack-comp-2",
        name: "Make",
        website: "https://make.com",
        strengths: ["Visual workflow builder", "Competitive pricing", "Strong European presence"],
        weaknesses: ["Steeper learning curve", "Weaker US market presence", "Limited support for non-technical users"],
        positioning: "Power-user automation platform with visual builder",
        pricingNotes: "Cheaper than Zapier but requires technical ops knowledge",
        customerComplaints: ["Too complex for our ops team", "Support response times are slow", "Documentation is lacking"],
        beatOpportunity: "Win on simplicity — concierge onboarding gets non-technical ops teams live in days, not weeks.",
      },
      {
        id: "stack-comp-3",
        name: "Monday.com",
        website: "https://monday.com",
        strengths: ["Full work OS platform", "Strong enterprise sales", "Beautiful UI"],
        weaknesses: ["Automation is a feature, not the product", "Expensive at scale ($15+/user/mo)", "Overkill for pure automation needs"],
        positioning: "Work management platform with built-in automation",
        pricingNotes: "Per-seat pricing makes automation expensive — $750+/mo for 50 users",
        customerComplaints: ["Paying for features we don't use", "Automation is limited compared to dedicated tools"],
        beatOpportunity: "Position as the focused alternative — best-in-class automation without the work OS bloat.",
      },
    ],
    recommendations,
    brandScore: score(64, 58, 62, 68, 55, 52, 70, 74, 62, {
      visibility: "Publish weekly LinkedIn content on ops automation — 3x engagement vs product posts.",
      trust: "Launch G2 review campaign — target 50 reviews in 60 days with gift card incentive.",
      demand: "Share automation scorecard lead magnet in 3 LinkedIn ops groups.",
      conversion: "Make onboarding concierge default — 34% close rate vs 12% without.",
      advocacy: "Create customer case study program — 3 vertical stories in 30 days.",
    }),
    metrics: metrics(opportunities, recommendations, "Ops leader actively comparing automation tools"),
    aiSummary:
      "Stackline's highest-leverage play is the active LinkedIn buyer comparing automation tools — engage today ($9,600 ACV). Your concierge onboarding converts at 34% vs 12% without it; make it mandatory on every demo immediately. Zapier backlash on Reddit is a timely displacement opportunity. Total active opportunity value: $69,500.",
  };
}

function buildFarmTable(): Business {
  const input = farmTableInput;
  const opportunities: Opportunity[] = [
    {
      id: "farm-opp-1",
      title: "Unanswered corporate catering inquiry",
      type: "buyer",
      description:
        "Intel's Portland office admin emailed 5 days ago requesting catering for a 40-person team lunch. No response sent.",
      source: "Mock: CRM / inbox signal",
      estimatedValue: 2800,
      confidenceScore: 95,
      urgencyScore: 98,
      recommendedAction: "Reply to Intel inquiry TODAY with menu options and same-week availability",
      aiOutreach:
        "Hi {{name}},\n\nApologies for the delay — we'd love to cater your team lunch! Here are 3 farm-to-table menu options for 40 guests, starting at $28/person.\n\nCan we hop on a 10-min call tomorrow to finalize?\n\n— Farm Table Kitchen",
      status: "new",
    },
    {
      id: "farm-opp-2",
      title: "Harvest House weak weekday traffic",
      type: "competitor_weakness",
      description:
        "Harvest House closed weekday lunch service last month. Their regulars are looking for alternatives on Yelp and Google.",
      source: "Mock: Google Reviews analysis",
      estimatedValue: 4200,
      confidenceScore: 80,
      urgencyScore: 72,
      recommendedAction: "Run 'Power Lunch' weekday promo — $15 farm bowl + drink, targeted at downtown workers",
      status: "saved",
    },
    {
      id: "farm-opp-3",
      title: "Meal prep subscription launch",
      type: "product",
      description:
        "23 customers asked about take-home meal boxes last quarter. No subscription product exists.",
      source: "Mock: Offer performance model",
      estimatedValue: 5600,
      confidenceScore: 77,
      urgencyScore: 65,
      recommendedAction: "Pilot 20-slot weekly meal prep box at $65/week with waitlist signup",
      status: "new",
    },
    {
      id: "farm-opp-4",
      title: "Farm-to-table story content gap",
      type: "content",
      description:
        "Your supplier relationships (3 local farms) are a differentiator but you have zero 'meet the farmer' content.",
      source: "Mock: Search trend signal",
      estimatedValue: 2400,
      confidenceScore: 82,
      urgencyScore: 50,
      recommendedAction: "Film 3 short farm visit videos for Instagram and embed on homepage",
      aiOutreach:
        "Post: This week's salad features greens from Sunstone Farm — 12 miles from our kitchen. That's the Farm Table difference 🌿",
      status: "new",
    },
    {
      id: "farm-opp-5",
      title: "Wedding venue catering partnership",
      type: "partnership",
      description:
        "The Nines hotel hosts 30+ weddings/year but outsources catering to a generic provider. No local farm-to-table option.",
      source: "Mock: Local business network",
      estimatedValue: 12000,
      confidenceScore: 68,
      urgencyScore: 55,
      recommendedAction: "Email The Nines events coordinator with wedding catering portfolio and tasting offer",
      status: "new",
    },
    {
      id: "farm-opp-6",
      title: "Yelp review response gap",
      type: "reputation",
      description:
        "8 unanswered Yelp reviews from the last 60 days. 3 are 4-star with constructive feedback.",
      source: "Mock: Review monitoring",
      estimatedValue: 1800,
      confidenceScore: 90,
      urgencyScore: 75,
      recommendedAction: "Respond to all 8 Yelp reviews today with personalized thank-you messages",
      status: "in_progress",
    },
    {
      id: "farm-opp-7",
      title: "Beaverton corporate lunch market",
      type: "geographic",
      description:
        "Beaverton tech campus area has 200+ companies with no farm-to-table lunch delivery option.",
      source: "Mock: Geographic demand map",
      estimatedValue: 7400,
      confidenceScore: 71,
      urgencyScore: 60,
      recommendedAction: "Launch corporate lunch delivery to Beaverton with $200 minimum order",
      status: "new",
    },
    {
      id: "farm-opp-8",
      title: "Happy hour pricing for slow Tuesdays",
      type: "pricing",
      description:
        "Tuesday dinner covers are 40% below Friday. A farm cocktail + small plate happy hour could fill seats.",
      source: "Mock: Competitive pricing scan",
      estimatedValue: 3100,
      confidenceScore: 78,
      urgencyScore: 55,
      recommendedAction: "Launch 'Farm Hour' Tuesdays 4–6pm: $8 cocktails + $12 small plates",
      status: "new",
    },
    {
      id: "farm-opp-9",
      title: "Private dining room underutilized",
      type: "market_gap",
      description:
        "Private room sits empty 4 weeknights/month. Corporate dinner market in Portland is underserved.",
      source: "Mock: Market scan",
      estimatedValue: 6500,
      confidenceScore: 74,
      urgencyScore: 48,
      recommendedAction: "Create 'Executive Farm Dinner' package for 8–16 guests at $85/person",
      status: "new",
    },
  ];

  const recommendations: Recommendation[] = [
    {
      id: "farm-rec-1",
      title: "Reply to Intel catering inquiry NOW",
      whyItMatters: "5-day-old inquiry from a 40-person corporate client. 95% confidence, $2,800 immediate + recurring potential.",
      whatToDoNext: "Send menu options email within the hour. Offer tasting for their next team event.",
      revenuePotential: 2800,
      priority: "high",
      emailDraft:
        "Subject: Farm-to-table catering for your team — menu options inside\n\nHi {{name}},\n\nThank you for reaching out! We'd love to cater your team lunch. Here are 3 seasonal menu options for 40 guests:\n\n1. Farm Bowl Bar — $28/person\n2. Family Style Farm Feast — $35/person\n3. Executive Box Lunch — $22/person\n\nAll ingredients sourced within 50 miles. Can we schedule a quick call this week?\n\n— Farm Table Kitchen",
      dmMessage: "Hi {{name}} — just saw your catering inquiry! We specialize in farm-to-table corporate events. Want me to send menu options?",
      offerIdea: "Corporate Lunch Launch: 10% off first 3 catering orders for new business clients",
      landingHeadline: "Portland's Farm-to-Table Catering for Teams That Care About Food",
    },
    {
      id: "farm-rec-2",
      title: "Capture Harvest House's lost weekday lunch crowd",
      whyItMatters: "Competitor just exited weekday lunch — their customers are actively searching for alternatives.",
      whatToDoNext: "Launch 'Power Lunch' promo and post in 2 local food Facebook groups.",
      revenuePotential: 4200,
      priority: "high",
      socialPost:
        "Looking for a weekday lunch spot downtown? 🌿 Farm Table Power Lunch: seasonal farm bowl + local drink for $15. Tue–Fri 11:30–2pm.",
      adConcept: "Headline: The Best $15 Lunch in Portland. Sub: Farm-fresh bowls. Downtown. No reservation needed.",
    },
    {
      id: "farm-rec-3",
      title: "Pitch The Nines hotel for wedding catering",
      whyItMatters: "One venue partnership = 30+ events/year at $4K+ average. Highest-leverage catering play.",
      whatToDoNext: "Email events coordinator with portfolio PDF and complimentary tasting offer.",
      revenuePotential: 12000,
      priority: "medium",
    },
  ];

  return {
    id: "demo-farm-table",
    createdAt: now(),
    updatedAt: now(),
    input,
    profile: {
      companySummary:
        "Farm Table Kitchen is a farm-to-table restaurant and catering company in Portland doing $50K–$100K/mo. Strong food reputation but weekday traffic is weak and catering inquiries are falling through the cracks — limiting the path to 40% catering revenue.",
      brandPositioning:
        "Portland's farm-to-table destination for people who care where their food comes from — dine in, cater, or take home the farm.",
      targetAudience: input.targetCustomer,
      productsServices: input.productsServices,
      strengths: [
        "Authentic farm-to-table sourcing from 3 local partner farms",
        "Strong dinner service reputation and repeat diners",
        "Private dining room and full catering capabilities",
      ],
      weaknesses: [
        "Catering inquiries going unanswered — revenue leaking",
        "Weekday lunch traffic 40% below weekend levels",
        "Zero 'farm story' content despite being core differentiator",
      ],
      marketOpportunities: [
        "Intel corporate catering inquiry sitting unanswered ($2,800)",
        "Harvest House exited weekday lunch — their customers need a home",
        "The Nines hotel wedding catering partnership untapped",
        "Beaverton corporate lunch delivery market wide open",
      ],
      suggestedCompetitors: ["Harvest House", "Green Fork Catering", "Portland Provisions"],
      brandImprovements: [
        "Set up catering inquiry auto-response with menu PDF within 1 hour",
        "Launch 'Power Lunch' weekday promo to capture downtown workers",
        "Film farm visit content series — 3 videos in 2 weeks",
        "Create corporate catering landing page separate from restaurant site",
      ],
    },
    opportunities,
    competitors: [
      {
        id: "farm-comp-1",
        name: "Harvest House",
        website: "https://harvesthousepdx.example",
        strengths: ["Established brand (8 years)", "Great dinner menu", "Strong Instagram"],
        weaknesses: ["Closed weekday lunch service", "No catering offering", "Higher price point"],
        positioning: "Upscale farm-to-table dinner destination",
        pricingNotes: "Dinner entrees $28–42 — premium positioning",
        customerComplaints: ["No lunch option anymore", "Hard to get reservations on weekends"],
        beatOpportunity: "Capture their lost weekday lunch crowd with affordable Power Lunch promo.",
      },
      {
        id: "farm-comp-2",
        name: "Green Fork Catering",
        website: "https://greenforkcatering.example",
        strengths: ["Strong corporate catering client base", "Fast response times", "Competitive pricing"],
        weaknesses: ["Generic food — not farm-to-table", "No restaurant presence", "Weak brand story"],
        positioning: "Volume corporate catering provider",
        pricingNotes: "Undercuts on price ($18–22/person) but quality reflects it",
        customerComplaints: ["Food tasted generic", "Same menu every time", "Not locally sourced"],
        beatOpportunity: "Win corporate clients on quality and story — 'Your team deserves farm-fresh, not Sysco.'",
      },
      {
        id: "farm-comp-3",
        name: "Portland Provisions",
        website: "https://portlandprovisions.example",
        strengths: ["Meal prep subscription model", "Strong delivery logistics", "Good app experience"],
        weaknesses: ["No dine-in or event capability", "Pre-made meals, not fresh", "Limited menu rotation"],
        positioning: "Meal prep delivery service for busy professionals",
        pricingNotes: "$55–75/week subscription — different category but competes for same customer wallet",
        customerComplaints: ["Meals feel reheated", "Boring after 2 weeks", "No customization"],
        beatOpportunity: "Launch meal prep box with fresh, rotating farm menu — premium alternative to their pre-made meals.",
      },
    ],
    recommendations,
    brandScore: score(75, 72, 78, 73, 68, 70, 77, 72, 48, {
      visibility: "Publish farm visit content weekly — your sourcing story is your biggest differentiator.",
      trust: "Respond to all 8 pending Yelp reviews today — silence kills restaurant credibility.",
      demand: "Launch corporate catering landing page and promote in 3 Portland business groups.",
      conversion: "Set up 1-hour auto-response for all catering inquiries with menu PDF attached.",
      advocacy: "Ask every catering client for Google review within 24 hours of event.",
    }),
    metrics: metrics(opportunities, recommendations, "Unanswered corporate catering inquiry"),
    aiSummary:
      "Farm Table has a $2,800 Intel catering inquiry sitting unanswered for 5 days — reply today. Harvest House just killed weekday lunch, and their customers are searching for alternatives — launch Power Lunch this week. The Nines hotel partnership could unlock $12K+ in annual wedding catering. Total active opportunity value: $43,300.",
  };
}

function buildMomentumFitness(): Business {
  const input = momentumInput;
  const opportunities: Opportunity[] = [
    {
      id: "mom-opp-1",
      title: "Corporate wellness RFP from downtown law firm",
      type: "buyer",
      description:
        "Baker & Associates (120 employees) posted an internal wellness RFP. Your contact forwarded it — deadline is Friday.",
      source: "Mock: CRM / referral signal",
      estimatedValue: 18000,
      confidenceScore: 82,
      urgencyScore: 96,
      recommendedAction: "Submit corporate wellness proposal by Thursday with 2 package tiers",
      aiOutreach:
        "Hi {{name}},\n\nThank you for thinking of Momentum for Baker & Associates' wellness program. Here's our proposal for 120 employees:\n\nTier 1: Lunch & Learn + 2 group sessions/mo — $2,500/mo\nTier 2: Full access + 1:1 coaching slots — $4,200/mo\n\nHappy to present to your wellness committee this week.\n\n— Momentum Fitness",
      status: "new",
    },
    {
      id: "mom-opp-2",
      title: "CrossFit Mile High retention problems",
      type: "competitor_weakness",
      description:
        "CrossFit Mile High has 8 recent reviews mentioning 'coaches leaving' and 'inconsistent programming.' Members are shopping.",
      source: "Mock: Google Reviews analysis",
      estimatedValue: 5400,
      confidenceScore: 79,
      urgencyScore: 74,
      recommendedAction: "Run 'Switch & Save' promo targeting CrossFit members — first month free",
      status: "saved",
    },
    {
      id: "mom-opp-3",
      title: "March retention cliff prevention",
      type: "product",
      description:
        "Historical data: 35% of January sign-ups cancel by March. No mid-program check-in or milestone system exists.",
      source: "Mock: Offer performance model",
      estimatedValue: 8200,
      confidenceScore: 85,
      urgencyScore: 90,
      recommendedAction: "Launch 'Day 45 Check-In' program — personal coach call + progress photos for all Jan sign-ups",
      status: "in_progress",
    },
    {
      id: "mom-opp-4",
      title: "Transformation Tuesday content series",
      type: "content",
      description:
        "Member transformation stories get 5x engagement but you only post them monthly. Competitors post weekly.",
      source: "Mock: Search trend signal",
      estimatedValue: 2800,
      confidenceScore: 80,
      urgencyScore: 55,
      recommendedAction: "Launch weekly 'Transformation Tuesday' with before/after + member quote",
      aiOutreach:
        "💪 Transformation Tuesday: Meet Sarah — down 22 lbs in 12 weeks with Momentum's small group program. 'I finally found accountability that works.' → Book your free assessment",
      status: "new",
    },
    {
      id: "mom-opp-5",
      title: "Physical therapy clinic referral loop",
      type: "partnership",
      description:
        "Denver Sports PT refers post-rehab patients to gyms but has no formal partner. 30+ referrals/month potential.",
      source: "Mock: Local business network",
      estimatedValue: 9600,
      confidenceScore: 72,
      urgencyScore: 62,
      recommendedAction: "Meet with Denver Sports PT owner — propose formal referral program with revenue share",
      status: "new",
    },
    {
      id: "mom-opp-6",
      title: "Google rating boost opportunity",
      type: "reputation",
      description:
        "You're at 4.7★ with 56 reviews. F45 has 4.5 with 200+. Volume gap affects 'best gym near me' ranking.",
      source: "Mock: Review monitoring",
      estimatedValue: 3400,
      confidenceScore: 84,
      urgencyScore: 58,
      recommendedAction: "Text all members who hit a PR this month asking for Google review",
      status: "new",
    },
    {
      id: "mom-opp-7",
      title: "Online coaching tier launch",
      type: "market_gap",
      description:
        "15 past members moved away but asked about remote coaching. No online tier exists.",
      source: "Mock: Market scan",
      estimatedValue: 7200,
      confidenceScore: 76,
      urgencyScore: 50,
      recommendedAction: "Launch $149/mo online coaching tier with app-based check-ins and programming",
      status: "new",
    },
    {
      id: "mom-opp-8",
      title: "Annual membership push",
      type: "pricing",
      description:
        "Only 22% of members are on annual plans. A 'Founding Member' annual rate could lock in 40+ members.",
      source: "Mock: Competitive pricing scan",
      estimatedValue: 6100,
      confidenceScore: 78,
      urgencyScore: 65,
      recommendedAction: "Email all monthly members: annual plan at $149/mo (save $600/yr) — limited to 50 spots",
      status: "new",
    },
    {
      id: "mom-opp-9",
      title: "Cherry Creek affluent demographic",
      type: "geographic",
      description:
        "Cherry Creek professionals match your ICP but Momentum has zero presence in that zip code marketing.",
      source: "Mock: Geographic demand map",
      estimatedValue: 4800,
      confidenceScore: 68,
      urgencyScore: 45,
      recommendedAction: "Run Meta ads targeting Cherry Creek 25–45 with free assessment offer",
      status: "new",
    },
  ];

  const recommendations: Recommendation[] = [
    {
      id: "mom-rec-1",
      title: "Submit Baker & Associates wellness proposal by Thursday",
      whyItMatters: "$18,000 annual contract at 82% confidence. Deadline is Friday — this is the biggest deal in your pipeline.",
      whatToDoNext: "Draft 2-tier proposal tonight. Schedule presentation with wellness committee for Wednesday.",
      revenuePotential: 18000,
      priority: "high",
      emailDraft:
        "Subject: Wellness proposal for Baker & Associates — 120 employees\n\nHi {{name}},\n\nAttached is our corporate wellness proposal with two options:\n\nTier 1 ($2,500/mo): Lunch & Learn series + 2 group sessions/month\nTier 2 ($4,200/mo): Full gym access + dedicated 1:1 coaching slots\n\nBoth include quarterly progress reports and employee engagement tracking.\n\nCan we present to your committee Wednesday?\n\n— Momentum Fitness",
      offerIdea: "Corporate Launch Special: First month free for companies signing 12-month wellness contract",
      landingHeadline: "Denver's Corporate Wellness Partner — Programs That Actually Get Results",
    },
    {
      id: "mom-rec-2",
      title: "Save January sign-ups from March cancellation cliff",
      whyItMatters: "35% of Jan sign-ups cancel by March — that's $8,200 in saved revenue if you intervene now.",
      whatToDoNext: "Schedule Day 45 check-in calls for all January members this week.",
      revenuePotential: 8200,
      priority: "high",
      socialPost:
        "35% of gym members quit by March. Not at Momentum. Our Day 45 check-in keeps you accountable and on track. 💪",
    },
    {
      id: "mom-rec-3",
      title: "Launch online coaching for relocated members",
      whyItMatters: "15 past members want remote coaching — that's $2,235/mo recurring with zero facility cost.",
      whatToDoNext: "Build $149/mo online tier landing page and email past members this weekend.",
      revenuePotential: 7200,
      priority: "medium",
      offerIdea: "Online Coaching Launch: $149/mo — app-based programming, weekly check-ins, nutrition guide",
    },
  ];

  return {
    id: "demo-momentum-fitness",
    createdAt: now(),
    updatedAt: now(),
    input,
    profile: {
      companySummary:
        "Momentum Fitness is a small-group training gym in Denver doing $20K–$50K/mo. Strong community and 4.7★ rating, but January retention cliff and untapped corporate wellness market limit growth toward 60 new members and online coaching launch.",
      brandPositioning:
        "Denver's accountability-first fitness studio — small groups, real coaches, measurable results for professionals who are done with generic gym experiences.",
      targetAudience: input.targetCustomer,
      productsServices: input.productsServices,
      strengths: [
        "4.7★ Google rating with strong member transformation stories",
        "Small-group model creates accountability and community",
        "Experienced coaches with nutrition and mobility expertise",
      ],
      weaknesses: [
        "35% January sign-up cancellation rate by March",
        "Only 22% of members on annual plans — revenue volatility",
        "No online coaching tier despite demand from relocated members",
      ],
      marketOpportunities: [
        "Baker & Associates corporate wellness RFP — $18K annual potential",
        "CrossFit Mile High retention problems — switch-ready members",
        "Denver Sports PT referral partnership — 30+ leads/month",
        "15 past members want online coaching — zero facility cost revenue",
      ],
      suggestedCompetitors: ["CrossFit Mile High", "F45 Denver", "Orange Theory LoDo"],
      brandImprovements: [
        "Launch Day 45 check-in program to prevent March cancellation cliff",
        "Create corporate wellness landing page and proposal template",
        "Start weekly Transformation Tuesday content series",
        "Build online coaching tier at $149/mo for remote members",
      ],
    },
    opportunities,
    competitors: [
      {
        id: "mom-comp-1",
        name: "CrossFit Mile High",
        website: "https://crossfitmilehigh.example",
        strengths: ["Strong community culture", "Central Denver location", "Competitive pricing"],
        weaknesses: ["Coach turnover (8 recent complaints)", "Inconsistent programming", "Intimidating for beginners"],
        positioning: "High-intensity CrossFit box for experienced athletes",
        pricingNotes: "$179/mo unlimited — price-competitive but high churn",
        customerComplaints: ["Third coach this year", "Workouts feel random", "Too intense for beginners"],
        beatOpportunity: "Target their frustrated members with 'consistent coaching, sustainable results' messaging.",
      },
      {
        id: "mom-comp-2",
        name: "F45 Denver",
        website: "https://f45denver.example",
        strengths: ["200+ Google reviews", "Franchise brand recognition", "Varied daily workouts"],
        weaknesses: ["4.5★ rating — quality inconsistency", "No personal coaching relationship", "Expensive ($200+/mo)"],
        positioning: "Franchise HIIT studio with daily varied workouts",
        pricingNotes: "$209/mo — premium pricing without personal attention",
        customerComplaints: ["Felt like a number", "Same workouts repeat", "No form correction"],
        beatOpportunity: "Win on personal attention — small groups with coaches who know your name and your goals.",
      },
      {
        id: "mom-comp-3",
        name: "Orange Theory LoDo",
        website: "https://orangetheorylodo.example",
        strengths: ["National brand", "Heart-rate tech differentiation", "Multiple Denver locations"],
        weaknesses: ["Corporate feel", "No strength training focus", "Class-only model limits progression"],
        positioning: "Tech-enabled cardio studio with heart-rate monitoring",
        pricingNotes: "$179/mo base — additional for extra classes",
        customerComplaints: ["Same class format every day", "No strength progression", "Feels corporate"],
        beatOpportunity: "Position as the progression-focused alternative — real strength gains, not just cardio points.",
      },
    ],
    recommendations,
    brandScore: score(70, 66, 73, 72, 64, 68, 74, 78, 55, {
      visibility: "Post Transformation Tuesday weekly — member stories are your best marketing.",
      trust: "Push Google reviews from 56 to 100+ with post-PR text requests.",
      demand: "Run Cherry Creek geo-targeted ads with free assessment offer.",
      conversion: "Launch Day 45 check-in to prevent March cancellation cliff.",
      advocacy: "Create member referral program: free month for every friend who joins.",
    }),
    metrics: metrics(opportunities, recommendations, "Corporate wellness RFP from downtown law firm"),
    aiSummary:
      "Momentum's #1 priority is the Baker & Associates wellness RFP — $18K annual contract due Friday. Second: intervene on January sign-ups before the March cancellation cliff ($8,200 at risk). CrossFit Mile High's coach turnover is creating switch-ready members — run a 'Switch & Save' promo now. Total active opportunity value: $63,500.",
  };
}

const launchpadInput: OnboardingInput = {
  businessName: "Launchpad AI",
  websiteUrl: "https://launchpadai.io",
  industry: "AI Startup",
  industryCategory: "Technology",
  businessSubtype: "AI Startups",
  location: "San Francisco, CA",
  businessType: "Solo founder",
  monthlyRevenueRange: "Pre-revenue",
  revenueGoal: "10 paying design partners in 90 days, then $10K MRR",
  biggestChallenge: "Too many ideas, no clear GTM — burning runway on the wrong channels",
  productsServices: "AI sales copilot for outbound SDRs — draft sequences, research leads, sync to CRM",
  mainCompetitors: "Apollo.io, Clay, Outreach",
  targetCustomer: "Founder-led B2B startups with 1–3 SDRs doing manual outbound",
};

function buildLaunchpad(): Business {
  const input = launchpadInput;
  const opportunities: Opportunity[] = [
    {
      id: "lp-opp-1",
      title: "Design partner ready to pay $499/mo",
      type: "buyer",
      description:
        "YC W24 alum replied to your cold email — wants a 2-week pilot for their 2-person SDR team. Decision this week.",
      source: "Mock: Inbox signal",
      estimatedValue: 5990,
      confidenceScore: 88,
      urgencyScore: 96,
      recommendedAction: "Send pilot agreement + onboarding calendar link before Friday",
      aiOutreach:
        "Subject: Launchpad AI pilot — 2 SDRs, live next week\n\nHi {{name}},\n\nGreat connecting. Attached: 14-day pilot scope, CRM sync checklist, and Cal link for 30-min kickoff.\n\n— {{founder_name}}",
      status: "new",
    },
    {
      id: "lp-opp-2",
      title: "Product Hunt launch window — Tuesday",
      type: "content",
      description:
        "PH hunter confirmed slot next Tuesday. Competitor Clay launched last month — timing is favorable for 'AI outbound for startups' angle.",
      source: "Mock: Launch calendar",
      estimatedValue: 4200,
      confidenceScore: 74,
      urgencyScore: 91,
      recommendedAction: "Finalize PH assets + email waitlist blast 24h before launch",
      status: "saved",
    },
    {
      id: "lp-opp-3",
      title: "Apollo users complaining on Reddit",
      type: "competitor_weakness",
      description:
        "r/sales thread: 'Apollo data quality dropped' — 40+ comments, founders asking for alternatives.",
      source: "Mock: Reddit signal",
      estimatedValue: 3600,
      confidenceScore: 81,
      urgencyScore: 84,
      recommendedAction: "Reply with value + link to free outbound audit tool (not hard pitch)",
      status: "new",
    },
    {
      id: "lp-opp-4",
      title: "Accelerator mentor intro to 3 ICP startups",
      type: "partnership",
      description:
        "Your Techstars mentor offered warm intros to three portfolio companies matching ICP (B2B SaaS, 5–20 employees).",
      source: "Mock: Network signal",
      estimatedValue: 9000,
      confidenceScore: 70,
      urgencyScore: 78,
      recommendedAction: "Send one-pager + 15-min demo ask to all three this week",
      status: "new",
    },
    {
      id: "lp-opp-5",
      title: "Landing page conversion leak",
      type: "geographic",
      description: "62% of traffic from LinkedIn but only 1.2% book demo — headline doesn't match ad promise.",
      source: "Mock: Analytics signal",
      estimatedValue: 2800,
      confidenceScore: 85,
      urgencyScore: 72,
      recommendedAction: "A/B test headline: 'AI copilot for founder-led outbound' vs current generic tagline",
      status: "new",
    },
  ];

  const recommendations: Recommendation[] = [
    {
      id: "lp-rec-1",
      title: "Close design partner pilot before Friday",
      whyItMatters: "First paid logo + case study unlocks next 5 conversations. $499/mo × 12 = $6K ACV.",
      whatToDoNext: "Send pilot agreement today. Block kickoff slot on calendar.",
      revenuePotential: 5990,
      priority: "high",
      emailDraft:
        "Subject: Launchpad pilot — ready when you are\n\nHi {{name}},\n\nPilot doc attached. We can have your sequences live in 48 hours.\n\n— {{founder_name}}",
      dmMessage:
        "Saw your reply — stoked to pilot with your SDR team. Sent agreement + kickoff link. Any blockers?",
    },
    {
      id: "lp-rec-2",
      title: "Ship Product Hunt launch prep by Monday",
      whyItMatters: "PH drives 200–800 signups for B2B tools in your category when timed with a clear wedge.",
      whatToDoNext: "Record 60s demo GIF, prep maker comment, alert waitlist 24h early.",
      revenuePotential: 4200,
      priority: "high",
      socialPost:
        "We're launching on Product Hunt Tuesday 🚀 — AI copilot that helps founder-led teams outbound without hiring a RevOps person. Would love your support → [link]",
    },
    {
      id: "lp-rec-3",
      title: "Engage Apollo complaint thread on Reddit",
      whyItMatters: "Switch-ready buyers actively asking for alternatives — zero ad spend.",
      whatToDoNext: "Post helpful reply + free audit link. Follow up DMs within 24h.",
      revenuePotential: 3600,
      priority: "medium",
    },
  ];

  return {
    id: "demo-launchpad",
    createdAt: now(),
    updatedAt: now(),
    input,
    profile: {
      companySummary:
        "Launchpad AI is a pre-revenue B2B startup building an AI sales copilot for founder-led outbound teams. Strong design-partner interest but GTM focus and conversion leaks are burning runway.",
      brandPositioning:
        "The AI copilot for founder-led outbound — research, draft, and sync sequences without hiring RevOps.",
      targetAudience: input.targetCustomer,
      productsServices: input.productsServices,
      strengths: [
        "Clear ICP wedge (founder-led SDR teams)",
        "Warm accelerator network and design partner pipeline",
        "Product differentiated on CRM-native workflows vs generic AI chat",
      ],
      weaknesses: [
        "Pre-revenue — no case studies yet",
        "Landing page conversion under 2%",
        "Split focus across too many channels",
      ],
      marketOpportunities: [
        "Paid design partner ready this week",
        "Product Hunt launch slot confirmed",
        "Competitor dissatisfaction on Reddit",
        "Three warm intros from accelerator mentor",
      ],
      suggestedCompetitors: ["Apollo.io", "Clay", "Outreach"],
      brandImprovements: [
        "Close first design partner for logo + testimonial",
        "Fix landing page message match for LinkedIn traffic",
        "Publish one 'founder outbound' case study (even pilot)",
      ],
    },
    opportunities,
    competitors: [
      {
        id: "lp-comp-1",
        name: "Apollo.io",
        website: "https://apollo.io",
        strengths: ["Huge contact database", "All-in-one outbound", "Strong brand with startups"],
        weaknesses: ["Data quality complaints rising", "Generic sequences", "Expensive at scale"],
        positioning: "Default startup outbound database + sequences",
        pricingNotes: "$49–119/user/mo — adds up fast for 3-person teams",
        customerComplaints: ["Emails bouncing more", "Feels spammy", "UI overwhelming"],
        beatOpportunity: "Win on quality + AI-native drafting tied to their actual CRM workflow.",
      },
      {
        id: "lp-comp-2",
        name: "Clay",
        website: "https://clay.com",
        strengths: ["Powerful enrichment", "Flexible workflows", "Strong PH community"],
        weaknesses: ["Steep learning curve", "Not built for solo founders", "Requires ops skill"],
        positioning: "Enrichment and workflow orchestration for growth teams",
        pricingNotes: "Credit-based — unpredictable for early startups",
        customerComplaints: ["Too complex for our stage", "Need a dedicated ops person"],
        beatOpportunity: "Position as 'Clay outcomes without Clay complexity' for 1–3 person sales teams.",
      },
      {
        id: "lp-comp-3",
        name: "Outreach",
        website: "https://outreach.io",
        strengths: ["Enterprise sales engagement", "Deep analytics", "Salesforce native"],
        weaknesses: ["Overkill for startups", "6-figure contracts", "Long implementation"],
        positioning: "Enterprise sales engagement platform",
        pricingNotes: "Not priced for pre-seed / seed teams",
        customerComplaints: ["Way too heavy for 2 SDRs", "Implementation took months"],
        beatOpportunity: "Capture startups that looked at Outreach and bounced on price/complexity.",
      },
    ],
    recommendations,
    brandScore: score(58, 52, 55, 61, 48, 44, 65, 72, 58, {
      visibility: "Product Hunt + LinkedIn founder story — double down next 2 weeks.",
      trust: "First paid design partner = instant credibility. Prioritize above all.",
      demand: "Reddit and accelerator intros are free qualified pipeline — work both this week.",
      conversion: "Fix landing headline to match LinkedIn ad promise — 62% traffic leaking.",
      advocacy: "Turn pilot customer into video testimonial within 30 days of go-live.",
    }),
    metrics: metrics(opportunities, recommendations, "Design partner ready to pay $499/mo"),
    aiSummary:
      "Launchpad's #1 move: close the design partner pilot before Friday ($6K ACV). #2: Product Hunt Tuesday — prep assets this weekend. Apollo pain on Reddit is free switch-ready demand. Total active opportunity value: $25,590.",
  };
}

const builders: Record<string, () => Business> = {
  "apex-roofing": buildApexRoofing,
  "greenedge-landscaping": buildGreenEdgeLandscaping,
  "vitalmed-supply": buildVitalMedSupply,
  "clearsmile-dental": buildClearSmileDental,
  "comfortzone-hvac": buildComfortZoneHVAC,
  "luxe-realty": buildLuxeRealty,
  "glow-studio": buildGlowStudio,
  stackline: buildStackline,
  launchpad: buildLaunchpad,
  "farm-table": buildFarmTable,
  "momentum-fitness": buildMomentumFitness,
};

export const DEMO_PROFILES: DemoProfileMeta[] = [
  {
    id: "apex-roofing",
    name: "Apex Roofing Co.",
    industry: "Home Services",
    location: "Austin, TX",
    tagline: "Storm-response roofing with $56K in active opportunities",
    revenueRange: "$20K–$50K/mo",
    revenuePotential: 56400,
    brandScore: 72,
    accent: "from-sky-500/20 to-sky-600/5",
  },
  {
    id: "glow-studio",
    name: "Glow Studio Med Spa",
    industry: "Beauty & Wellness",
    location: "Miami, FL",
    tagline: "Premium med spa with 47 clients ready to rebook",
    revenueRange: "$50K–$100K/mo",
    revenuePotential: 58500,
    brandScore: 81,
    accent: "from-indigo-500/20 to-indigo-600/5",
  },
  {
    id: "launchpad",
    name: "Launchpad AI",
    industry: "AI Startup",
    location: "San Francisco, CA",
    tagline: "Pre-revenue founder with a $499/mo design partner ready to sign",
    revenueRange: "Pre-revenue",
    revenuePotential: 25590,
    brandScore: 58,
    accent: "from-fuchsia-500/20 to-violet-600/5",
    category: "startup",
  },
  {
    id: "stackline",
    name: "Stackline",
    industry: "B2B SaaS",
    location: "Remote (US)",
    tagline: "Workflow automation SaaS with an active buyer on LinkedIn",
    revenueRange: "$5K–$20K/mo",
    revenuePotential: 69500,
    brandScore: 64,
    accent: "from-violet-500/20 to-violet-600/5",
    category: "startup",
  },
  {
    id: "farm-table",
    name: "Farm Table Kitchen",
    industry: "Food & Hospitality",
    location: "Portland, OR",
    tagline: "Farm-to-table restaurant with a $2,800 catering lead waiting",
    revenueRange: "$50K–$100K/mo",
    revenuePotential: 43300,
    brandScore: 75,
    accent: "from-amber-500/20 to-amber-600/5",
  },
  {
    id: "momentum-fitness",
    name: "Momentum Fitness",
    industry: "Health & Fitness",
    location: "Denver, CO",
    tagline: "Training gym with an $18K corporate wellness deal pending",
    revenueRange: "$20K–$50K/mo",
    revenuePotential: 63500,
    brandScore: 70,
    accent: "from-emerald-500/20 to-emerald-600/5",
  },
  {
    id: "greenedge-landscaping",
    name: "GreenEdge Landscaping",
    industry: "Landscaping",
    location: "Nashville, TN",
    tagline: "HOA RFP worth $24K plus spring cleanup season starting",
    revenueRange: "$20K–$50K/mo",
    revenuePotential: 94300,
    brandScore: 74,
    accent: "from-lime-500/20 to-green-600/5",
  },
  {
    id: "vitalmed-supply",
    name: "VitalMed Supply Co.",
    industry: "Medical Products",
    location: "Dallas, TX",
    tagline: "B2B medical distributor with a $180K surgery center RFP",
    revenueRange: "$50K–$100K/mo",
    revenuePotential: 478500,
    brandScore: 76,
    accent: "from-cyan-500/20 to-teal-600/5",
  },
  {
    id: "clearsmile-dental",
    name: "ClearSmile Dental Group",
    industry: "Dental",
    location: "Phoenix, AZ",
    tagline: "Hot Invisalign lead waiting — call within 30 minutes",
    revenueRange: "$50K–$100K/mo",
    revenuePotential: 76600,
    brandScore: 79,
    accent: "from-blue-500/20 to-sky-600/5",
  },
  {
    id: "comfortzone-hvac",
    name: "ComfortZone HVAC",
    industry: "HVAC",
    location: "Atlanta, GA",
    tagline: "Heat wave emergency calls plus 258 maintenance plans to sell",
    revenueRange: "$20K–$50K/mo",
    revenuePotential: 123300,
    brandScore: 71,
    accent: "from-orange-500/20 to-red-600/5",
  },
  {
    id: "luxe-realty",
    name: "Luxe Realty Partners",
    industry: "Real Estate",
    location: "Charlotte, NC",
    tagline: "Investor buyer seeking Ballantyne duplexes right now",
    revenueRange: "$50K–$100K/mo",
    revenuePotential: 138200,
    brandScore: 73,
    accent: "from-rose-500/20 to-pink-600/5",
  },
];

export function getDemoBusiness(id: string): Business | null {
  const builder = builders[id];
  if (!builder) return null;
  const business = enrichBusinessWithRoles(builder());
  return attachDemoDigitalPresence(business, id);
}

export function getDemoMeta(id: string): DemoProfileMeta | undefined {
  return DEMO_PROFILES.find((p) => p.id === id);
}
