"use strict";
/**
 * Onboarding Tier Router (W5.1-support of F-NEW-PRODUCT-AGENT-VISIBILITY-CLUSTER-2026-05-12).
 *
 * Pure decision helper for the non-technical onboarding ladder. Takes a
 * prospect profile (tech-team size, install capability, vertical, agent
 * count, cloud-LLM-only?, whether they're regulated) and recommends a
 * Tier with reasoning.
 *
 * Tier A  Proxy URL swap (zero install)        cloud-LLM-only customers
 * Tier B  Browser extension                    individual users + small teams
 * Tier C  CSM-assisted install (Zoom)          mid-market with hooks needed
 * Tier D  MSP / partner channel installation   regulated enterprises
 * Tier E  Compliance-as-a-Service (fully run)  zero-AI-team regulated firms
 *
 * Engine consumed by the dashboard signup flow + the landing-page
 * "Which tier is right for you?" wizard.
 *
 * @connexum/ai-governance  F-NEW-PRODUCT-NON-TECH-ONBOARDING-LADDER (router substrate)
 */
Object.defineProperty(exports, "__esModule", { value: true });
exports.recommendOnboardingTier = recommendOnboardingTier;
const TIER_LABEL = {
    A: 'Proxy URL swap (zero install)',
    B: 'Browser extension',
    C: 'CSM-assisted install',
    D: 'MSP / partner channel install',
    E: 'Compliance-as-a-Service (fully managed)',
};
const TIER_CTA = {
    A: 'Start with one URL change — get your proxy snippet now',
    B: 'Install the Chrome extension and see your governance in 60 seconds',
    C: 'Book a 30-minute install session with our customer success team',
    D: 'Talk to a certified MSP partner for a guided deployment',
    E: 'Get a managed dashboard + monthly compliance reports — we run it',
};
function recommendOnboardingTier(profile) {
    const reasoning = [];
    const alternatives = [];
    // ---- Hard signals that pin a specific tier ----
    // Tier E: explicit ask for fully-managed compliance
    if (profile.wantsFullyManaged) {
        reasoning.push('Customer explicitly wants a fully-managed compliance service.');
        if (profile.regulated) {
            reasoning.push('Regulated industry; CaaS bundles monthly compliance reports.');
        }
        alternatives.push({ tier: 'D', reason: 'MSP channel if a partner is already engaged' });
        return tier('E', reasoning, alternatives);
    }
    // Tier D: regulated + existing MSP partner relationship
    if (profile.regulated && profile.hasMspPartner) {
        reasoning.push('Regulated industry with an existing MSP / system-integrator relationship.');
        reasoning.push('Partner-managed install minimizes change-control friction.');
        alternatives.push({ tier: 'C', reason: 'Direct CSM install if you want to keep MSP out of the loop' });
        alternatives.push({ tier: 'E', reason: 'Move to CaaS if MSP capacity is constrained' });
        return tier('D', reasoning, alternatives);
    }
    // Tier A: zero technical lift — cloud-LLM-only and at least one engineer to change a URL
    if (profile.cloudLlmOnly && profile.techTeamSize >= 1) {
        reasoning.push('Agents are cloud-LLM-only — proxy URL swap covers the full governance surface.');
        reasoning.push(`Tech team has ${profile.techTeamSize} engineer(s) — capacity to change an env var.`);
        alternatives.push({ tier: 'C', reason: 'CSM-assisted if your team prefers to watch the install on a call' });
        if (profile.agentCount >= 50) {
            alternatives.push({ tier: 'D', reason: 'MSP channel scales for fleets of 50+ agents' });
        }
        return tier('A', reasoning, alternatives);
    }
    // Tier B: individual / small team, browser-driven AI usage.
    // Regulated orgs never land here — they need formal install + audit
    // chain, not browser extension. Regulated falls through to Tier D below.
    if (profile.techTeamSize === 0 && profile.agentCount <= 5 && !profile.regulated) {
        reasoning.push('No dedicated tech team and a small agent footprint.');
        reasoning.push('Browser extension covers Claude.ai / Cursor / ChatGPT sessions without install in the codebase.');
        alternatives.push({ tier: 'C', reason: 'CSM-assisted if you outgrow the extension' });
        return tier('B', reasoning, alternatives);
    }
    // Tier C: default for mid-market with tool-using agents that need hooks
    if (profile.techTeamSize >= 1 && profile.techTeamSize <= 10) {
        reasoning.push(`Tech team of ${profile.techTeamSize} can install hooks with guided support.`);
        if (!profile.cloudLlmOnly) {
            reasoning.push('Agents use tools beyond LLM calls — full hook install required.');
        }
        alternatives.push({ tier: 'A', reason: 'If you can pin agents to cloud-LLM-only, swap to proxy instead' });
        if (profile.regulated) {
            alternatives.push({ tier: 'D', reason: 'MSP channel scales better in a regulated org' });
        }
        return tier('C', reasoning, alternatives);
    }
    // Tier D (default for larger): regulated or large-team
    if (profile.techTeamSize > 10 || profile.regulated) {
        reasoning.push(profile.regulated
            ? 'Regulated industry — partner-managed install + ongoing compliance support.'
            : `Tech team of ${profile.techTeamSize} is large enough to want a managed install programme.`);
        alternatives.push({ tier: 'C', reason: 'Direct CSM install if you want full ownership' });
        alternatives.push({ tier: 'E', reason: 'CaaS if you want us to run the whole programme' });
        return tier('D', reasoning, alternatives);
    }
    // Fallback: Tier A (cloud-LLM-only assumption) with a note
    reasoning.push('Fallback: proxy URL swap is the lowest-friction path.');
    alternatives.push({ tier: 'C', reason: 'CSM-assisted if proxy alone is insufficient' });
    return tier('A', reasoning, alternatives);
}
function tier(t, reasoning, alternatives) {
    return {
        tier: t,
        label: TIER_LABEL[t],
        reasoning,
        alternatives,
        cta: TIER_CTA[t],
    };
}
//# sourceMappingURL=onboarding-tier-router.js.map