"""
The verbatim anchor — Forrester *The Total Economic Impact™ Of CX Cloud —
Cost Savings And Business Benefits Enabled By Genesys And Salesforce*
(December 2025, commissioned by Genesys and Salesforce).

VERBATIM, do not edit. These are Forrester's published composite-organization
tables and financial summary, transplanted unchanged from the study PDF
(``docs/The-Total-Economic-Impact-Of-CX-Cloud.pdf``). Client personalization
lives in :mod:`teicalc.overlay`; scenario stress lives in
:mod:`teicalc.scenarios` — both deep-copy, neither mutates this record.

Rows keep Forrester's own year-index keys (``"1"``/``"2"``/``"3"``);
:mod:`teicalc.model` maps them to calendar years (2026–2028). Values are
*nominal* (pre-risk-adjustment); the risk factor is stored per row and
applied by the model (benefits ×(1−rf), costs ×(1+rf), per the TEI
methodology).

Two study-specific footnotes, preserved from the source review:

* The published Total Costs table (p.14) prints the implementation initial
  as $1,304,600, but the detail table, the cash-flow analysis, and the math
  (1,190,000 × 1.10) all give **$1,309,000** — the p.14 figure is a typo in
  the study.
* ``genesys_ai_tokens`` is **not in the published study** — Forrester
  modeled $0 AI consumption even though benefits B (self-service uplift),
  C (agent efficiency), and D (agent assist upsell) all depend on AI
  capabilities that Genesys bills via AI Experience tokens. The row is
  anchored at $0 so the reproduction matches the published totals; client
  cases price it via the overlay's ``ai_tokens_annual`` driver.
"""

from __future__ import annotations

#: 3-year nominal benefit cashflows — 🟢 published.
BENEFITS_VERBATIM: list[dict] = [
    {
        "field_key": "legacy_retirement",
        "table": "benefits",
        "label": "Retirement of legacy systems with CX Cloud adoption",
        "category": "Cost Savings",
        "year_values": {"1": 680_000, "2": 930_000, "3": 930_000},
        "risk_adjustment": 0.05,
        "notes": (
            "PDF A1–A4. Telephony $250k Y1 ramping to $500k (legacy "
            "sunset completes mid-Y1) + WFM/recording/transcription apps "
            "$100k + reduced dev effort $230k (2,400 hrs @ $94) + reduced "
            "platform mgmt $100k (1,500 hrs @ $65). Risk adj 5%."
        ),
    },
    {
        "field_key": "self_service_savings",
        "table": "benefits",
        "label": (
            "Cost savings from reallocated workers and avoided seasonal "
            "hires with increased customer self-service"
        ),
        "category": "Productivity",
        "year_values": {"1": 2_329_600, "2": 2_329_600, "3": 2_329_600},
        "risk_adjustment": 0.15,
        "notes": (
            "PDF B1–B8. Self-service completion 15%→25% on 80k weekly "
            "interactions → 8,000 deflected/week → 40 FTEs @ $58,240 "
            "fully burdened. Risk adj 15%. (PDF B7 formula cites B2 where "
            "the 12-min interaction length is meant; 40 FTEs is correct.)"
        ),
    },
    {
        "field_key": "agent_efficiency",
        "table": "benefits",
        "label": "CX agent efficiency gains",
        "category": "Productivity",
        "year_values": {"1": 2_912_000, "2": 2_912_000, "3": 2_912_000},
        "risk_adjustment": 0.10,
        "notes": (
            "PDF C1–C6. MTTR 12→10 min on 60k agent-handled interactions "
            "per week → 104,000 hrs/yr @ $28 fully burdened. Risk adj 10%."
        ),
    },
    {
        "field_key": "agent_assist_sales",
        "table": "benefits",
        "label": "Incremental sales from agent assist capabilities",
        "category": "Revenue",
        "year_values": {"1": 600_000, "2": 600_000, "3": 600_000},
        "risk_adjustment": 0.05,
        "notes": (
            "PDF D1–D3. $500M revenue impacted (20% of $2.5B) × 1.5% lift "
            "× 8% gross margin. Risk adj 5%."
        ),
    },
]


#: Costs include an ``initial`` (year-0, undiscounted) component for
#: implementation. Cost risk adjustments are applied *upward*. 🟢 published
#: (except the ``genesys_ai_tokens`` line — see the module docstring).
COSTS_VERBATIM: list[dict] = [
    {
        "field_key": "cx_cloud_licenses",
        "table": "costs",
        "label": "CX Cloud solution costs (licenses)",
        "category": "Subscription",
        "initial": 0,
        "year_values": {"1": 840_000, "2": 840_000, "3": 840_000},
        "risk_adjustment": 0.05,
        "notes": (
            "PDF E1–E3. Genesys Cloud CX 2 $170/user/mo + Salesforce "
            "Voice $25/user/mo + connector $25/user/mo, 400 concurrent "
            "users, 20% contractual discount → $650k + $95k + $95k. "
            "Risk adj +5%. Seat licenses ONLY — AI consumption is a "
            "separate line (genesys_ai_tokens)."
        ),
    },
    {
        "field_key": "implementation",
        "table": "costs",
        "label": "Implementation and deployment cost",
        "category": "Implementation",
        "initial": 1_190_000,
        "year_values": {"1": 0, "2": 0, "3": 0},
        "risk_adjustment": 0.10,
        "notes": (
            "PDF F1–F5. 10-week implementation: 20 FTEs @ $80/hr fully "
            "burdened ($640k) + $550k professional services. Risk adj "
            "+10% → $1,309,000 (the p.14 Total Costs table's $1,304,600 "
            "is a typo in the study)."
        ),
    },
    {
        "field_key": "ongoing_management",
        "table": "costs",
        "label": "Ongoing management costs",
        "category": "Operations",
        "initial": 0,
        "year_values": {"1": 202_800, "2": 202_800, "3": 202_800},
        "risk_adjustment": 0.10,
        "notes": (
            "PDF G1–G3. 5 people @ 30% time (12 hrs/wk) @ $65/hr. "
            "Risk adj +10%."
        ),
    },
    {
        "field_key": "genesys_ai_tokens",
        "table": "costs",
        "label": "Genesys AI Experience token consumption",
        "category": "Subscription",
        "initial": 0,
        "year_values": {"1": 0, "2": 0, "3": 0},
        "risk_adjustment": 0.0,
        "notes": (
            "NOT in the published study — Forrester modeled $0 AI "
            "consumption even though benefits B (self-service uplift), "
            "C (AI coaching/assist), and D (agent assist upsell) all "
            "depend on AI capabilities that Genesys bills via AI "
            "Experience tokens. Anchored at $0 to reproduce the published "
            "totals. For client cases, enter the negotiated annual token "
            "cost from the Genesys quote (the overlay's ai_tokens_annual "
            "driver) and document the quote details (token volume, unit "
            "price, tier)."
        ),
    },
]


#: Composite-organization drivers — 🟢 published (PDF "Composite Organization").
ASSUMPTIONS: dict = {
    "annual_revenue": 2_500_000_000,
    "employees": 10_000,
    "agents_fte": 600,
    "concurrent_licenses": 400,
    "weekly_interactions": 80_000,
    "interaction_minutes": 12,
    "self_service_rate_before": 0.15,
    "self_service_rate_after": 0.25,
    "mttr_saved_minutes": 2,
    "agent_hourly_rate": 28,
    "agent_annual_salary": 58_240,
    "revenue_impacted": 500_000_000,
    "revenue_lift": 0.015,
    "gross_margin": 0.08,
    "discount_rate": 0.10,
    "analysis_years": 3,
}


#: The PDF's Financial Summary — the gate's reproduction target. 🟢 published.
#: The engine reproduces these to within $2 (Forrester's own rounding).
#: Forrester does not headline a payback for this study; the engine computes
#: 3.3 months from the cash-flow table.
PUBLISHED: dict = {
    "benefits_pv": 14_840_638,
    "costs_pv": 4_057_170,
    "npv": 10_783_468,
    "roi_pct": 266,
    "discount_rate": 0.10,
    "analysis_years": 3,
}
