{
 "cells": [
  {
   "cell_type": "markdown",
   "id": "g2-md-intro",
   "metadata": {},
   "source": [
    "# 02 \u2014 Costs Analysis\n",
    "\n",
    "**Study:** Forrester *TEI\u2122 Of CX Cloud \u2014 Genesys + Salesforce* (December 2025)\n",
    "\n",
    "Three published cost categories on a 3-year horizon at a 10% discount\n",
    "rate, **plus a fourth Palladium-added line** for Genesys AI Experience\n",
    "token consumption \u2014 which the published study omits despite three of its\n",
    "four benefits depending on AI capabilities Genesys bills via tokens.\n",
    "\n",
    "Published target Costs PV = **\\$4,057,170** (the AI-tokens line is\n",
    "seeded at \\$0 here; `03_business_case.ipynb` runs the sensitivity)."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "02-bootstrap",
   "metadata": {},
   "outputs": [],
   "source": [
    "import sys, pathlib                       # path shim: works on a fresh kernel\n",
    "for _p in [pathlib.Path.cwd(), *pathlib.Path.cwd().parents]:\n",
    "    if (_p / \"pyproject.toml\").exists():\n",
    "        sys.path.insert(0, str(_p)); break\n",
    "\n",
    "from core.bootstrap import init\n",
    "\n",
    "pal = init(study=\"202512_GenesysCX\")\n",
    "client, seed, config = pal.client, pal.seed_data, pal.config\n",
    "\n",
    "STUDY = pal.root / 'studies' / '202512_GenesysCX'\n",
    "ROOT  = pal.root\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "id": "g2-code-imports",
   "metadata": {},
   "outputs": [],
   "source": [
    "from core.calculations import npv, risk_adjust_cost\n",
    "from core.notebook_helpers import charts, display, tables"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "g2-md-cost-table",
   "metadata": {},
   "source": [
    "## Costs \u2014 what the deal looks like\n",
    "\n",
    "| Ref | Cost | Initial | Y1 | Y2 | Y3 | Risk Adj |\n",
    "|---|---|---|---|---|---|---|\n",
    "| Et | CX Cloud licenses (400 concurrent) | \u2014 | \\$840K | \\$840K | \\$840K | \u21915% |\n",
    "| Ft | Implementation & deployment (10-week project) | \\$1.19M | \u2014 | \u2014 | \u2014 | \u219110% |\n",
    "| Gt | Ongoing management (5 staff @ 30%) | \u2014 | \\$203K | \\$203K | \\$203K | \u219110% |\n",
    "| **+** | **Genesys AI Experience tokens** *(Palladium add)* | \u2014 | per quote | per quote | per quote | 0% |\n",
    "\n",
    "Note **costs are risk-adjusted *upward*** (higher risk \u2192 higher modelled\n",
    "cost) \u2014 Forrester convention, opposite of how benefits get adjusted.\n",
    "\n",
    "**PDF caveat:** the published Total Costs table (p.14) prints the\n",
    "implementation initial as \\$1,304,600, but the detail rows, the cash flow\n",
    "analysis, and the literal arithmetic (\\$1,190,000 \u00d7 1.10) all give\n",
    "\\$1,309,000. The seed uses the correct figure."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "id": "g2-code-table",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<style type=\"text/css\">\n",
       "</style>\n",
       "<table id=\"T_e9207\">\n",
       "  <thead>\n",
       "    <tr>\n",
       "      <th class=\"blank level0\" >&nbsp;</th>\n",
       "      <th id=\"T_e9207_level0_col0\" class=\"col_heading level0 col0\" >field_key</th>\n",
       "      <th id=\"T_e9207_level0_col1\" class=\"col_heading level0 col1\" >label</th>\n",
       "      <th id=\"T_e9207_level0_col2\" class=\"col_heading level0 col2\" >category</th>\n",
       "      <th id=\"T_e9207_level0_col3\" class=\"col_heading level0 col3\" >risk_adjustment</th>\n",
       "      <th id=\"T_e9207_level0_col4\" class=\"col_heading level0 col4\" >Initial</th>\n",
       "      <th id=\"T_e9207_level0_col5\" class=\"col_heading level0 col5\" >Initial (RA)</th>\n",
       "      <th id=\"T_e9207_level0_col6\" class=\"col_heading level0 col6\" >Year 1</th>\n",
       "      <th id=\"T_e9207_level0_col7\" class=\"col_heading level0 col7\" >Year 1 (RA)</th>\n",
       "      <th id=\"T_e9207_level0_col8\" class=\"col_heading level0 col8\" >Year 2</th>\n",
       "      <th id=\"T_e9207_level0_col9\" class=\"col_heading level0 col9\" >Year 2 (RA)</th>\n",
       "      <th id=\"T_e9207_level0_col10\" class=\"col_heading level0 col10\" >Year 3</th>\n",
       "      <th id=\"T_e9207_level0_col11\" class=\"col_heading level0 col11\" >Year 3 (RA)</th>\n",
       "      <th id=\"T_e9207_level0_col12\" class=\"col_heading level0 col12\" >Total</th>\n",
       "      <th id=\"T_e9207_level0_col13\" class=\"col_heading level0 col13\" >Total (RA)</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th id=\"T_e9207_level0_row0\" class=\"row_heading level0 row0\" >0</th>\n",
       "      <td id=\"T_e9207_row0_col0\" class=\"data row0 col0\" >cx_cloud_licenses</td>\n",
       "      <td id=\"T_e9207_row0_col1\" class=\"data row0 col1\" >CX Cloud solution costs (licenses)</td>\n",
       "      <td id=\"T_e9207_row0_col2\" class=\"data row0 col2\" >Subscription</td>\n",
       "      <td id=\"T_e9207_row0_col3\" class=\"data row0 col3\" >0.050000</td>\n",
       "      <td id=\"T_e9207_row0_col4\" class=\"data row0 col4\" >$0</td>\n",
       "      <td id=\"T_e9207_row0_col5\" class=\"data row0 col5\" >$0</td>\n",
       "      <td id=\"T_e9207_row0_col6\" class=\"data row0 col6\" >$840,000</td>\n",
       "      <td id=\"T_e9207_row0_col7\" class=\"data row0 col7\" >$882,000</td>\n",
       "      <td id=\"T_e9207_row0_col8\" class=\"data row0 col8\" >$840,000</td>\n",
       "      <td id=\"T_e9207_row0_col9\" class=\"data row0 col9\" >$882,000</td>\n",
       "      <td id=\"T_e9207_row0_col10\" class=\"data row0 col10\" >$840,000</td>\n",
       "      <td id=\"T_e9207_row0_col11\" class=\"data row0 col11\" >$882,000</td>\n",
       "      <td id=\"T_e9207_row0_col12\" class=\"data row0 col12\" >$2,520,000</td>\n",
       "      <td id=\"T_e9207_row0_col13\" class=\"data row0 col13\" >$2,646,000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th id=\"T_e9207_level0_row1\" class=\"row_heading level0 row1\" >1</th>\n",
       "      <td id=\"T_e9207_row1_col0\" class=\"data row1 col0\" >implementation</td>\n",
       "      <td id=\"T_e9207_row1_col1\" class=\"data row1 col1\" >Implementation and deployment cost</td>\n",
       "      <td id=\"T_e9207_row1_col2\" class=\"data row1 col2\" >Implementation</td>\n",
       "      <td id=\"T_e9207_row1_col3\" class=\"data row1 col3\" >0.100000</td>\n",
       "      <td id=\"T_e9207_row1_col4\" class=\"data row1 col4\" >$1,190,000</td>\n",
       "      <td id=\"T_e9207_row1_col5\" class=\"data row1 col5\" >$1,309,000</td>\n",
       "      <td id=\"T_e9207_row1_col6\" class=\"data row1 col6\" >$0</td>\n",
       "      <td id=\"T_e9207_row1_col7\" class=\"data row1 col7\" >$0</td>\n",
       "      <td id=\"T_e9207_row1_col8\" class=\"data row1 col8\" >$0</td>\n",
       "      <td id=\"T_e9207_row1_col9\" class=\"data row1 col9\" >$0</td>\n",
       "      <td id=\"T_e9207_row1_col10\" class=\"data row1 col10\" >$0</td>\n",
       "      <td id=\"T_e9207_row1_col11\" class=\"data row1 col11\" >$0</td>\n",
       "      <td id=\"T_e9207_row1_col12\" class=\"data row1 col12\" >$1,190,000</td>\n",
       "      <td id=\"T_e9207_row1_col13\" class=\"data row1 col13\" >$1,309,000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th id=\"T_e9207_level0_row2\" class=\"row_heading level0 row2\" >2</th>\n",
       "      <td id=\"T_e9207_row2_col0\" class=\"data row2 col0\" >ongoing_management</td>\n",
       "      <td id=\"T_e9207_row2_col1\" class=\"data row2 col1\" >Ongoing management costs</td>\n",
       "      <td id=\"T_e9207_row2_col2\" class=\"data row2 col2\" >Operations</td>\n",
       "      <td id=\"T_e9207_row2_col3\" class=\"data row2 col3\" >0.100000</td>\n",
       "      <td id=\"T_e9207_row2_col4\" class=\"data row2 col4\" >$0</td>\n",
       "      <td id=\"T_e9207_row2_col5\" class=\"data row2 col5\" >$0</td>\n",
       "      <td id=\"T_e9207_row2_col6\" class=\"data row2 col6\" >$202,800</td>\n",
       "      <td id=\"T_e9207_row2_col7\" class=\"data row2 col7\" >$223,080</td>\n",
       "      <td id=\"T_e9207_row2_col8\" class=\"data row2 col8\" >$202,800</td>\n",
       "      <td id=\"T_e9207_row2_col9\" class=\"data row2 col9\" >$223,080</td>\n",
       "      <td id=\"T_e9207_row2_col10\" class=\"data row2 col10\" >$202,800</td>\n",
       "      <td id=\"T_e9207_row2_col11\" class=\"data row2 col11\" >$223,080</td>\n",
       "      <td id=\"T_e9207_row2_col12\" class=\"data row2 col12\" >$608,400</td>\n",
       "      <td id=\"T_e9207_row2_col13\" class=\"data row2 col13\" >$669,240</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th id=\"T_e9207_level0_row3\" class=\"row_heading level0 row3\" >3</th>\n",
       "      <td id=\"T_e9207_row3_col0\" class=\"data row3 col0\" >genesys_ai_tokens</td>\n",
       "      <td id=\"T_e9207_row3_col1\" class=\"data row3 col1\" >Genesys AI Experience token consumption</td>\n",
       "      <td id=\"T_e9207_row3_col2\" class=\"data row3 col2\" >Subscription</td>\n",
       "      <td id=\"T_e9207_row3_col3\" class=\"data row3 col3\" >0.000000</td>\n",
       "      <td id=\"T_e9207_row3_col4\" class=\"data row3 col4\" >$0</td>\n",
       "      <td id=\"T_e9207_row3_col5\" class=\"data row3 col5\" >$0</td>\n",
       "      <td id=\"T_e9207_row3_col6\" class=\"data row3 col6\" >$0</td>\n",
       "      <td id=\"T_e9207_row3_col7\" class=\"data row3 col7\" >$0</td>\n",
       "      <td id=\"T_e9207_row3_col8\" class=\"data row3 col8\" >$0</td>\n",
       "      <td id=\"T_e9207_row3_col9\" class=\"data row3 col9\" >$0</td>\n",
       "      <td id=\"T_e9207_row3_col10\" class=\"data row3 col10\" >$0</td>\n",
       "      <td id=\"T_e9207_row3_col11\" class=\"data row3 col11\" >$0</td>\n",
       "      <td id=\"T_e9207_row3_col12\" class=\"data row3 col12\" >$0</td>\n",
       "      <td id=\"T_e9207_row3_col13\" class=\"data row3 col13\" >$0</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n"
      ],
      "text/plain": [
       "<pandas.io.formats.style.Styler at 0x1234d3ec0>"
      ]
     },
     "execution_count": 3,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df = tables.costs_table(seed.COSTS)\n",
    "df.style.format({c: '${:,.0f}' for c in df.columns if c not in ('field_key','label','category','risk_adjustment')})"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "g2-md-source-notes",
   "metadata": {},
   "source": [
    "### Where each cost comes from"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "id": "g2-code-source-notes",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<style type=\"text/css\">\n",
       "#T_2a876_row0_col0, #T_2a876_row0_col1, #T_2a876_row0_col2, #T_2a876_row0_col3, #T_2a876_row0_col4, #T_2a876_row0_col5, #T_2a876_row1_col0, #T_2a876_row1_col1, #T_2a876_row1_col2, #T_2a876_row1_col3, #T_2a876_row1_col4, #T_2a876_row1_col5, #T_2a876_row2_col0, #T_2a876_row2_col1, #T_2a876_row2_col2, #T_2a876_row2_col3, #T_2a876_row2_col4, #T_2a876_row2_col5, #T_2a876_row3_col0, #T_2a876_row3_col1, #T_2a876_row3_col2, #T_2a876_row3_col3, #T_2a876_row3_col4, #T_2a876_row3_col5 {\n",
       "  text-align: left;\n",
       "}\n",
       "</style>\n",
       "<table id=\"T_2a876\">\n",
       "  <thead>\n",
       "    <tr>\n",
       "      <th class=\"blank level0\" >&nbsp;</th>\n",
       "      <th id=\"T_2a876_level0_col0\" class=\"col_heading level0 col0\" >Ref</th>\n",
       "      <th id=\"T_2a876_level0_col1\" class=\"col_heading level0 col1\" >Cost</th>\n",
       "      <th id=\"T_2a876_level0_col2\" class=\"col_heading level0 col2\" >Risk Adj</th>\n",
       "      <th id=\"T_2a876_level0_col3\" class=\"col_heading level0 col3\" >Initial</th>\n",
       "      <th id=\"T_2a876_level0_col4\" class=\"col_heading level0 col4\" >3-yr Annual (Nominal)</th>\n",
       "      <th id=\"T_2a876_level0_col5\" class=\"col_heading level0 col5\" >Source / formula</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th id=\"T_2a876_level0_row0\" class=\"row_heading level0 row0\" >0</th>\n",
       "      <td id=\"T_2a876_row0_col0\" class=\"data row0 col0\" >Et</td>\n",
       "      <td id=\"T_2a876_row0_col1\" class=\"data row0 col1\" >CX Cloud solution costs (licenses)</td>\n",
       "      <td id=\"T_2a876_row0_col2\" class=\"data row0 col2\" >+5%</td>\n",
       "      <td id=\"T_2a876_row0_col3\" class=\"data row0 col3\" >$0</td>\n",
       "      <td id=\"T_2a876_row0_col4\" class=\"data row0 col4\" >$2,520,000</td>\n",
       "      <td id=\"T_2a876_row0_col5\" class=\"data row0 col5\" >PDF E1\u2013E3. Genesys Cloud CX 2 $170/user/mo + Salesforce Voice $25/user/mo + connector $25/user/mo, 400 concurrent users, 20% contractual discount \u2192 $650k + $95k + $95k. Risk adj +5%. Seat licenses ONLY \u2014 AI consumption is a separate line (genesys_ai_tokens).</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th id=\"T_2a876_level0_row1\" class=\"row_heading level0 row1\" >1</th>\n",
       "      <td id=\"T_2a876_row1_col0\" class=\"data row1 col0\" >Ft</td>\n",
       "      <td id=\"T_2a876_row1_col1\" class=\"data row1 col1\" >Implementation and deployment cost</td>\n",
       "      <td id=\"T_2a876_row1_col2\" class=\"data row1 col2\" >+10%</td>\n",
       "      <td id=\"T_2a876_row1_col3\" class=\"data row1 col3\" >$1,190,000</td>\n",
       "      <td id=\"T_2a876_row1_col4\" class=\"data row1 col4\" >$0</td>\n",
       "      <td id=\"T_2a876_row1_col5\" class=\"data row1 col5\" >PDF F1\u2013F5. 10-week implementation: 20 FTEs @ $80/hr fully burdened ($640k) + $550k professional services. Risk adj +10% \u2192 $1,309,000 (the p.14 Total Costs table's $1,304,600 is a typo in the study).</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th id=\"T_2a876_level0_row2\" class=\"row_heading level0 row2\" >2</th>\n",
       "      <td id=\"T_2a876_row2_col0\" class=\"data row2 col0\" >Gt</td>\n",
       "      <td id=\"T_2a876_row2_col1\" class=\"data row2 col1\" >Ongoing management costs</td>\n",
       "      <td id=\"T_2a876_row2_col2\" class=\"data row2 col2\" >+10%</td>\n",
       "      <td id=\"T_2a876_row2_col3\" class=\"data row2 col3\" >$0</td>\n",
       "      <td id=\"T_2a876_row2_col4\" class=\"data row2 col4\" >$608,400</td>\n",
       "      <td id=\"T_2a876_row2_col5\" class=\"data row2 col5\" >PDF G1\u2013G3. 5 people @ 30% time (12 hrs/wk) @ $65/hr. Risk adj +10%.</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th id=\"T_2a876_level0_row3\" class=\"row_heading level0 row3\" >3</th>\n",
       "      <td id=\"T_2a876_row3_col0\" class=\"data row3 col0\" >+ AI</td>\n",
       "      <td id=\"T_2a876_row3_col1\" class=\"data row3 col1\" >Genesys AI Experience token consumption</td>\n",
       "      <td id=\"T_2a876_row3_col2\" class=\"data row3 col2\" >+0%</td>\n",
       "      <td id=\"T_2a876_row3_col3\" class=\"data row3 col3\" >$0</td>\n",
       "      <td id=\"T_2a876_row3_col4\" class=\"data row3 col4\" >$0</td>\n",
       "      <td id=\"T_2a876_row3_col5\" class=\"data row3 col5\" >NOT in the published study \u2014 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. Seeded at $0 to reproduce the published totals. For client cases, enter the negotiated annual token cost from the Genesys quote and document the quote details (token volume, unit price, tier) in these notes.</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n"
      ],
      "text/plain": [
       "<pandas.io.formats.style.Styler at 0x1270aaf30>"
      ]
     },
     "execution_count": 4,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "import pandas as pd\n",
    "\n",
    "notes_df = pd.DataFrame([\n",
    "    {\n",
    "        'Ref': ref,\n",
    "        'Cost': c['label'],\n",
    "        'Risk Adj': f\"+{c['risk_adjustment']:.0%}\",\n",
    "        'Initial': c.get('initial', 0),\n",
    "        '3-yr Annual (Nominal)': sum(c['year_values'].values()),\n",
    "        'Source / formula': c['notes'],\n",
    "    }\n",
    "    for ref, c in zip(['Et', 'Ft', 'Gt', '+ AI'], seed.COSTS)\n",
    "])\n",
    "notes_df.style.format({'Initial': '${:,.0f}', '3-yr Annual (Nominal)': '${:,.0f}'}).set_properties(**{'text-align': 'left'})"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "g2-md-validation",
   "metadata": {},
   "source": [
    "## Local validation against the PDF\n",
    "\n",
    "Reproduce the **\\$4,057,170** Costs PV from the PDF Cash Flow Analysis.\n",
    "Forrester applies risk *upward* to costs (`value \u00d7 (1 + risk_adj)`),\n",
    "leaves Year-0 *Initial* amounts undiscounted, and discounts Years 1\u20133\n",
    "at 10%. The `genesys_ai_tokens` line is seeded at \\$0, so it doesn't\n",
    "move the published total."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "id": "g2-code-validation",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<style type=\"text/css\">\n",
       "</style>\n",
       "<table id=\"T_87bd7\">\n",
       "  <thead>\n",
       "    <tr>\n",
       "      <th class=\"blank level0\" >&nbsp;</th>\n",
       "      <th id=\"T_87bd7_level0_col0\" class=\"col_heading level0 col0\" >Cost</th>\n",
       "      <th id=\"T_87bd7_level0_col1\" class=\"col_heading level0 col1\" >Initial (RA)</th>\n",
       "      <th id=\"T_87bd7_level0_col2\" class=\"col_heading level0 col2\" >Y1 (RA)</th>\n",
       "      <th id=\"T_87bd7_level0_col3\" class=\"col_heading level0 col3\" >Y2 (RA)</th>\n",
       "      <th id=\"T_87bd7_level0_col4\" class=\"col_heading level0 col4\" >Y3 (RA)</th>\n",
       "      <th id=\"T_87bd7_level0_col5\" class=\"col_heading level0 col5\" >PV</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th id=\"T_87bd7_level0_row0\" class=\"row_heading level0 row0\" >0</th>\n",
       "      <td id=\"T_87bd7_row0_col0\" class=\"data row0 col0\" >CX Cloud solution costs (licenses)</td>\n",
       "      <td id=\"T_87bd7_row0_col1\" class=\"data row0 col1\" >$0</td>\n",
       "      <td id=\"T_87bd7_row0_col2\" class=\"data row0 col2\" >$882,000</td>\n",
       "      <td id=\"T_87bd7_row0_col3\" class=\"data row0 col3\" >$882,000</td>\n",
       "      <td id=\"T_87bd7_row0_col4\" class=\"data row0 col4\" >$882,000</td>\n",
       "      <td id=\"T_87bd7_row0_col5\" class=\"data row0 col5\" >$2,193,403</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th id=\"T_87bd7_level0_row1\" class=\"row_heading level0 row1\" >1</th>\n",
       "      <td id=\"T_87bd7_row1_col0\" class=\"data row1 col0\" >Implementation and deployment cost</td>\n",
       "      <td id=\"T_87bd7_row1_col1\" class=\"data row1 col1\" >$1,309,000</td>\n",
       "      <td id=\"T_87bd7_row1_col2\" class=\"data row1 col2\" >$0</td>\n",
       "      <td id=\"T_87bd7_row1_col3\" class=\"data row1 col3\" >$0</td>\n",
       "      <td id=\"T_87bd7_row1_col4\" class=\"data row1 col4\" >$0</td>\n",
       "      <td id=\"T_87bd7_row1_col5\" class=\"data row1 col5\" >$1,309,000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th id=\"T_87bd7_level0_row2\" class=\"row_heading level0 row2\" >2</th>\n",
       "      <td id=\"T_87bd7_row2_col0\" class=\"data row2 col0\" >Ongoing management costs</td>\n",
       "      <td id=\"T_87bd7_row2_col1\" class=\"data row2 col1\" >$0</td>\n",
       "      <td id=\"T_87bd7_row2_col2\" class=\"data row2 col2\" >$223,080</td>\n",
       "      <td id=\"T_87bd7_row2_col3\" class=\"data row2 col3\" >$223,080</td>\n",
       "      <td id=\"T_87bd7_row2_col4\" class=\"data row2 col4\" >$223,080</td>\n",
       "      <td id=\"T_87bd7_row2_col5\" class=\"data row2 col5\" >$554,767</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th id=\"T_87bd7_level0_row3\" class=\"row_heading level0 row3\" >3</th>\n",
       "      <td id=\"T_87bd7_row3_col0\" class=\"data row3 col0\" >Genesys AI Experience token consumption</td>\n",
       "      <td id=\"T_87bd7_row3_col1\" class=\"data row3 col1\" >$0</td>\n",
       "      <td id=\"T_87bd7_row3_col2\" class=\"data row3 col2\" >$0</td>\n",
       "      <td id=\"T_87bd7_row3_col3\" class=\"data row3 col3\" >$0</td>\n",
       "      <td id=\"T_87bd7_row3_col4\" class=\"data row3 col4\" >$0</td>\n",
       "      <td id=\"T_87bd7_row3_col5\" class=\"data row3 col5\" >$0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th id=\"T_87bd7_level0_row4\" class=\"row_heading level0 row4\" >4</th>\n",
       "      <td id=\"T_87bd7_row4_col0\" class=\"data row4 col0\" >TOTAL</td>\n",
       "      <td id=\"T_87bd7_row4_col1\" class=\"data row4 col1\" >$1,309,000</td>\n",
       "      <td id=\"T_87bd7_row4_col2\" class=\"data row4 col2\" >$1,105,080</td>\n",
       "      <td id=\"T_87bd7_row4_col3\" class=\"data row4 col3\" >$1,105,080</td>\n",
       "      <td id=\"T_87bd7_row4_col4\" class=\"data row4 col4\" >$1,105,080</td>\n",
       "      <td id=\"T_87bd7_row4_col5\" class=\"data row4 col5\" >$4,057,170</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n"
      ],
      "text/plain": [
       "<pandas.io.formats.style.Styler at 0x1269cd1f0>"
      ]
     },
     "execution_count": 5,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "rows = []\n",
    "for c in seed.COSTS:\n",
    "    rf = c['risk_adjustment']\n",
    "    init_ra = risk_adjust_cost(c.get('initial') or 0, rf)\n",
    "    yr = [c['year_values'][str(y)] for y in (1, 2, 3)]\n",
    "    yr_ra = [risk_adjust_cost(v, rf) for v in yr]\n",
    "    pv = npv(yr_ra, config.DISCOUNT_RATE, initial=init_ra)\n",
    "    rows.append({\n",
    "        'Cost': c['label'],\n",
    "        'Initial (RA)': init_ra,\n",
    "        'Y1 (RA)': yr_ra[0],\n",
    "        'Y2 (RA)': yr_ra[1],\n",
    "        'Y3 (RA)': yr_ra[2],\n",
    "        'PV': pv,\n",
    "    })\n",
    "df_check = pd.DataFrame(rows)\n",
    "totals = df_check.drop(columns='Cost').sum()\n",
    "df_check.loc[len(df_check)] = ['TOTAL'] + totals.tolist()\n",
    "df_check.style.format({c: '${:,.0f}' for c in df_check.columns if c != 'Cost'})"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "id": "g2-code-pv-check",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div style=\"padding:10px 14px;border-left:4px solid #2e7d32;background:#e8f5e9;color:#1a1a1a;border-radius:4px;margin:6px 0;\">Computed Costs PV: <b>$4,057,170</b><br>Forrester target:  <b>$4,057,170</b><br>\u0394 = $0</div>"
      ],
      "text/plain": [
       "<IPython.core.display.HTML object>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "expected_pv = seed.PUBLISHED['total_costs_pv']   # 4,057,170\n",
    "computed_pv = df_check.iloc[-1]['PV']\n",
    "delta = computed_pv - expected_pv\n",
    "kind = 'success' if abs(delta) < 100 else 'warning'\n",
    "display.alert(\n",
    "    f'Computed Costs PV: <b>${computed_pv:,.0f}</b><br>'\n",
    "    f'Forrester target:  <b>${expected_pv:,.0f}</b><br>'\n",
    "    f'\u0394 = ${delta:,.0f}',\n",
    "    kind,\n",
    ")"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "g2-md-athena-delta",
   "metadata": {},
   "source": [
    "### Athena vs Forrester \u2014 the Year-0 discounting delta\n",
    "\n",
    "Forrester leaves the \\$1.309M implementation initial undiscounted in\n",
    "Year 0. **Athena treats non-annual values as Year-1 cashflows**, so it\n",
    "discounts the same amount (\\$1,309,000 / 1.10 = \\$1,190,000), making\n",
    "Athena's Costs PV ~\\$119k *lower* than Forrester's. That's methodology,\n",
    "not data error \u2014 `seed_data.ATHENA_EXPECTED` records the expected\n",
    "server-side total, and `00_provision.ipynb` verifies the pipeline\n",
    "matches it tightly before reconciling against the published number."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "id": "g2-code-athena-delta",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<style type=\"text/css\">\n",
       "</style>\n",
       "<table id=\"T_5dd38\">\n",
       "  <thead>\n",
       "    <tr>\n",
       "      <th class=\"blank level0\" >&nbsp;</th>\n",
       "      <th id=\"T_5dd38_level0_col0\" class=\"col_heading level0 col0\" >metric</th>\n",
       "      <th id=\"T_5dd38_level0_col1\" class=\"col_heading level0 col1\" >Forrester (published)</th>\n",
       "      <th id=\"T_5dd38_level0_col2\" class=\"col_heading level0 col2\" >Athena (expected)</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th id=\"T_5dd38_level0_row0\" class=\"row_heading level0 row0\" >0</th>\n",
       "      <td id=\"T_5dd38_row0_col0\" class=\"data row0 col0\" >total_benefits_pv</td>\n",
       "      <td id=\"T_5dd38_row0_col1\" class=\"data row0 col1\" >14,840,638</td>\n",
       "      <td id=\"T_5dd38_row0_col2\" class=\"data row0 col2\" >14,840,640</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th id=\"T_5dd38_level0_row1\" class=\"row_heading level0 row1\" >1</th>\n",
       "      <td id=\"T_5dd38_row1_col0\" class=\"data row1 col0\" >total_costs_pv</td>\n",
       "      <td id=\"T_5dd38_row1_col1\" class=\"data row1 col1\" >4,057,170</td>\n",
       "      <td id=\"T_5dd38_row1_col2\" class=\"data row1 col2\" >3,938,170</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th id=\"T_5dd38_level0_row2\" class=\"row_heading level0 row2\" >2</th>\n",
       "      <td id=\"T_5dd38_row2_col0\" class=\"data row2 col0\" >net_present_value</td>\n",
       "      <td id=\"T_5dd38_row2_col1\" class=\"data row2 col1\" >10,783,468</td>\n",
       "      <td id=\"T_5dd38_row2_col2\" class=\"data row2 col2\" >10,902,470</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th id=\"T_5dd38_level0_row3\" class=\"row_heading level0 row3\" >3</th>\n",
       "      <td id=\"T_5dd38_row3_col0\" class=\"data row3 col0\" >roi_percentage</td>\n",
       "      <td id=\"T_5dd38_row3_col1\" class=\"data row3 col1\" >266</td>\n",
       "      <td id=\"T_5dd38_row3_col2\" class=\"data row3 col2\" >277</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n"
      ],
      "text/plain": [
       "<pandas.io.formats.style.Styler at 0x1270d4d70>"
      ]
     },
     "execution_count": 7,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "delta_df = pd.DataFrame([\n",
    "    {'metric': k,\n",
    "     'Forrester (published)': seed.PUBLISHED[k],\n",
    "     'Athena (expected)':     seed.ATHENA_EXPECTED[k]}\n",
    "    for k in ('total_benefits_pv', 'total_costs_pv', 'net_present_value', 'roi_percentage')\n",
    "])\n",
    "delta_df.style.format({\n",
    "    'Forrester (published)': '{:,.0f}',\n",
    "    'Athena (expected)':     '{:,.0f}',\n",
    "})"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "g2-md-mix",
   "metadata": {},
   "source": [
    "## Cost mix\n",
    "\n",
    "At seeded values, **CX Cloud licenses dominate** (~62% of 3-year cost),\n",
    "with implementation a one-time investment. The AI-tokens slice is zero\n",
    "until you enter the quote in `03_business_case.ipynb` \u2014 and that's\n",
    "exactly the point: in real deals it can rival the license line."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "id": "g2-code-pie",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "application/vnd.plotly.v1+json": {
       "config": {
        "plotlyServerURL": "https://plot.ly"
       },
       "data": [
        {
         "hole": 0.35,
         "labels": [
          "CX Cloud solution costs (licenses)",
          "Implementation and deployment cost",
          "Ongoing management costs",
          "Genesys AI Experience token consumption"
         ],
         "marker": {
          "colors": [
           "#1565C0",
           "#2E7D32",
           "#C62828",
           "#F9A825",
           "#6A1B9A",
           "#00838F",
           "#EF6C00",
           "#5D4037",
           "#37474F",
           "#AD1457"
          ]
         },
         "type": "pie",
         "values": [
          2646000,
          1309000,
          669240.0000000001,
          0
         ]
        }
       ],
       "layout": {
        "font": {
         "color": "#1F2937",
         "family": "Helvetica, Arial, sans-serif"
        },
        "legend": {
         "font": {
          "color": "#1F2937",
          "family": "Helvetica, Arial, sans-serif"
         }
        },
        "margin": {
         "b": 40,
         "l": 40,
         "r": 20,
         "t": 60
        },
        "template": {
         "data": {
          "bar": [
           {
            "error_x": {
             "color": "#2a3f5f"
            },
            "error_y": {
             "color": "#2a3f5f"
            },
            "marker": {
             "line": {
              "color": "#E5ECF6",
              "width": 0.5
             },
             "pattern": {
              "fillmode": "overlay",
              "size": 10,
              "solidity": 0.2
             }
            },
            "type": "bar"
           }
          ],
          "barpolar": [
           {
            "marker": {
             "line": {
              "color": "#E5ECF6",
              "width": 0.5
             },
             "pattern": {
              "fillmode": "overlay",
              "size": 10,
              "solidity": 0.2
             }
            },
            "type": "barpolar"
           }
          ],
          "carpet": [
           {
            "aaxis": {
             "endlinecolor": "#2a3f5f",
             "gridcolor": "white",
             "linecolor": "white",
             "minorgridcolor": "white",
             "startlinecolor": "#2a3f5f"
            },
            "baxis": {
             "endlinecolor": "#2a3f5f",
             "gridcolor": "white",
             "linecolor": "white",
             "minorgridcolor": "white",
             "startlinecolor": "#2a3f5f"
            },
            "type": "carpet"
           }
          ],
          "choropleth": [
           {
            "colorbar": {
             "outlinewidth": 0,
             "ticks": ""
            },
            "type": "choropleth"
           }
          ],
          "contour": [
           {
            "colorbar": {
             "outlinewidth": 0,
             "ticks": ""
            },
            "colorscale": [
             [
              0,
              "#0d0887"
             ],
             [
              0.1111111111111111,
              "#46039f"
             ],
             [
              0.2222222222222222,
              "#7201a8"
             ],
             [
              0.3333333333333333,
              "#9c179e"
             ],
             [
              0.4444444444444444,
              "#bd3786"
             ],
             [
              0.5555555555555556,
              "#d8576b"
             ],
             [
              0.6666666666666666,
              "#ed7953"
             ],
             [
              0.7777777777777778,
              "#fb9f3a"
             ],
             [
              0.8888888888888888,
              "#fdca26"
             ],
             [
              1,
              "#f0f921"
             ]
            ],
            "type": "contour"
           }
          ],
          "contourcarpet": [
           {
            "colorbar": {
             "outlinewidth": 0,
             "ticks": ""
            },
            "type": "contourcarpet"
           }
          ],
          "heatmap": [
           {
            "colorbar": {
             "outlinewidth": 0,
             "ticks": ""
            },
            "colorscale": [
             [
              0,
              "#0d0887"
             ],
             [
              0.1111111111111111,
              "#46039f"
             ],
             [
              0.2222222222222222,
              "#7201a8"
             ],
             [
              0.3333333333333333,
              "#9c179e"
             ],
             [
              0.4444444444444444,
              "#bd3786"
             ],
             [
              0.5555555555555556,
              "#d8576b"
             ],
             [
              0.6666666666666666,
              "#ed7953"
             ],
             [
              0.7777777777777778,
              "#fb9f3a"
             ],
             [
              0.8888888888888888,
              "#fdca26"
             ],
             [
              1,
              "#f0f921"
             ]
            ],
            "type": "heatmap"
           }
          ],
          "histogram": [
           {
            "marker": {
             "pattern": {
              "fillmode": "overlay",
              "size": 10,
              "solidity": 0.2
             }
            },
            "type": "histogram"
           }
          ],
          "histogram2d": [
           {
            "colorbar": {
             "outlinewidth": 0,
             "ticks": ""
            },
            "colorscale": [
             [
              0,
              "#0d0887"
             ],
             [
              0.1111111111111111,
              "#46039f"
             ],
             [
              0.2222222222222222,
              "#7201a8"
             ],
             [
              0.3333333333333333,
              "#9c179e"
             ],
             [
              0.4444444444444444,
              "#bd3786"
             ],
             [
              0.5555555555555556,
              "#d8576b"
             ],
             [
              0.6666666666666666,
              "#ed7953"
             ],
             [
              0.7777777777777778,
              "#fb9f3a"
             ],
             [
              0.8888888888888888,
              "#fdca26"
             ],
             [
              1,
              "#f0f921"
             ]
            ],
            "type": "histogram2d"
           }
          ],
          "histogram2dcontour": [
           {
            "colorbar": {
             "outlinewidth": 0,
             "ticks": ""
            },
            "colorscale": [
             [
              0,
              "#0d0887"
             ],
             [
              0.1111111111111111,
              "#46039f"
             ],
             [
              0.2222222222222222,
              "#7201a8"
             ],
             [
              0.3333333333333333,
              "#9c179e"
             ],
             [
              0.4444444444444444,
              "#bd3786"
             ],
             [
              0.5555555555555556,
              "#d8576b"
             ],
             [
              0.6666666666666666,
              "#ed7953"
             ],
             [
              0.7777777777777778,
              "#fb9f3a"
             ],
             [
              0.8888888888888888,
              "#fdca26"
             ],
             [
              1,
              "#f0f921"
             ]
            ],
            "type": "histogram2dcontour"
           }
          ],
          "mesh3d": [
           {
            "colorbar": {
             "outlinewidth": 0,
             "ticks": ""
            },
            "type": "mesh3d"
           }
          ],
          "parcoords": [
           {
            "line": {
             "colorbar": {
              "outlinewidth": 0,
              "ticks": ""
             }
            },
            "type": "parcoords"
           }
          ],
          "pie": [
           {
            "automargin": true,
            "type": "pie"
           }
          ],
          "scatter": [
           {
            "fillpattern": {
             "fillmode": "overlay",
             "size": 10,
             "solidity": 0.2
            },
            "type": "scatter"
           }
          ],
          "scatter3d": [
           {
            "line": {
             "colorbar": {
              "outlinewidth": 0,
              "ticks": ""
             }
            },
            "marker": {
             "colorbar": {
              "outlinewidth": 0,
              "ticks": ""
             }
            },
            "type": "scatter3d"
           }
          ],
          "scattercarpet": [
           {
            "marker": {
             "colorbar": {
              "outlinewidth": 0,
              "ticks": ""
             }
            },
            "type": "scattercarpet"
           }
          ],
          "scattergeo": [
           {
            "marker": {
             "colorbar": {
              "outlinewidth": 0,
              "ticks": ""
             }
            },
            "type": "scattergeo"
           }
          ],
          "scattergl": [
           {
            "marker": {
             "colorbar": {
              "outlinewidth": 0,
              "ticks": ""
             }
            },
            "type": "scattergl"
           }
          ],
          "scattermap": [
           {
            "marker": {
             "colorbar": {
              "outlinewidth": 0,
              "ticks": ""
             }
            },
            "type": "scattermap"
           }
          ],
          "scattermapbox": [
           {
            "marker": {
             "colorbar": {
              "outlinewidth": 0,
              "ticks": ""
             }
            },
            "type": "scattermapbox"
           }
          ],
          "scatterpolar": [
           {
            "marker": {
             "colorbar": {
              "outlinewidth": 0,
              "ticks": ""
             }
            },
            "type": "scatterpolar"
           }
          ],
          "scatterpolargl": [
           {
            "marker": {
             "colorbar": {
              "outlinewidth": 0,
              "ticks": ""
             }
            },
            "type": "scatterpolargl"
           }
          ],
          "scatterternary": [
           {
            "marker": {
             "colorbar": {
              "outlinewidth": 0,
              "ticks": ""
             }
            },
            "type": "scatterternary"
           }
          ],
          "surface": [
           {
            "colorbar": {
             "outlinewidth": 0,
             "ticks": ""
            },
            "colorscale": [
             [
              0,
              "#0d0887"
             ],
             [
              0.1111111111111111,
              "#46039f"
             ],
             [
              0.2222222222222222,
              "#7201a8"
             ],
             [
              0.3333333333333333,
              "#9c179e"
             ],
             [
              0.4444444444444444,
              "#bd3786"
             ],
             [
              0.5555555555555556,
              "#d8576b"
             ],
             [
              0.6666666666666666,
              "#ed7953"
             ],
             [
              0.7777777777777778,
              "#fb9f3a"
             ],
             [
              0.8888888888888888,
              "#fdca26"
             ],
             [
              1,
              "#f0f921"
             ]
            ],
            "type": "surface"
           }
          ],
          "table": [
           {
            "cells": {
             "fill": {
              "color": "#EBF0F8"
             },
             "line": {
              "color": "white"
             }
            },
            "header": {
             "fill": {
              "color": "#C8D4E3"
             },
             "line": {
              "color": "white"
             }
            },
            "type": "table"
           }
          ]
         },
         "layout": {
          "annotationdefaults": {
           "arrowcolor": "#2a3f5f",
           "arrowhead": 0,
           "arrowwidth": 1
          },
          "autotypenumbers": "strict",
          "coloraxis": {
           "colorbar": {
            "outlinewidth": 0,
            "ticks": ""
           }
          },
          "colorscale": {
           "diverging": [
            [
             0,
             "#8e0152"
            ],
            [
             0.1,
             "#c51b7d"
            ],
            [
             0.2,
             "#de77ae"
            ],
            [
             0.3,
             "#f1b6da"
            ],
            [
             0.4,
             "#fde0ef"
            ],
            [
             0.5,
             "#f7f7f7"
            ],
            [
             0.6,
             "#e6f5d0"
            ],
            [
             0.7,
             "#b8e186"
            ],
            [
             0.8,
             "#7fbc41"
            ],
            [
             0.9,
             "#4d9221"
            ],
            [
             1,
             "#276419"
            ]
           ],
           "sequential": [
            [
             0,
             "#0d0887"
            ],
            [
             0.1111111111111111,
             "#46039f"
            ],
            [
             0.2222222222222222,
             "#7201a8"
            ],
            [
             0.3333333333333333,
             "#9c179e"
            ],
            [
             0.4444444444444444,
             "#bd3786"
            ],
            [
             0.5555555555555556,
             "#d8576b"
            ],
            [
             0.6666666666666666,
             "#ed7953"
            ],
            [
             0.7777777777777778,
             "#fb9f3a"
            ],
            [
             0.8888888888888888,
             "#fdca26"
            ],
            [
             1,
             "#f0f921"
            ]
           ],
           "sequentialminus": [
            [
             0,
             "#0d0887"
            ],
            [
             0.1111111111111111,
             "#46039f"
            ],
            [
             0.2222222222222222,
             "#7201a8"
            ],
            [
             0.3333333333333333,
             "#9c179e"
            ],
            [
             0.4444444444444444,
             "#bd3786"
            ],
            [
             0.5555555555555556,
             "#d8576b"
            ],
            [
             0.6666666666666666,
             "#ed7953"
            ],
            [
             0.7777777777777778,
             "#fb9f3a"
            ],
            [
             0.8888888888888888,
             "#fdca26"
            ],
            [
             1,
             "#f0f921"
            ]
           ]
          },
          "colorway": [
           "#636efa",
           "#EF553B",
           "#00cc96",
           "#ab63fa",
           "#FFA15A",
           "#19d3f3",
           "#FF6692",
           "#B6E880",
           "#FF97FF",
           "#FECB52"
          ],
          "font": {
           "color": "#2a3f5f"
          },
          "geo": {
           "bgcolor": "white",
           "lakecolor": "white",
           "landcolor": "#E5ECF6",
           "showlakes": true,
           "showland": true,
           "subunitcolor": "white"
          },
          "hoverlabel": {
           "align": "left"
          },
          "hovermode": "closest",
          "mapbox": {
           "style": "light"
          },
          "paper_bgcolor": "white",
          "plot_bgcolor": "#E5ECF6",
          "polar": {
           "angularaxis": {
            "gridcolor": "white",
            "linecolor": "white",
            "ticks": ""
           },
           "bgcolor": "#E5ECF6",
           "radialaxis": {
            "gridcolor": "white",
            "linecolor": "white",
            "ticks": ""
           }
          },
          "scene": {
           "xaxis": {
            "backgroundcolor": "#E5ECF6",
            "gridcolor": "white",
            "gridwidth": 2,
            "linecolor": "white",
            "showbackground": true,
            "ticks": "",
            "zerolinecolor": "white"
           },
           "yaxis": {
            "backgroundcolor": "#E5ECF6",
            "gridcolor": "white",
            "gridwidth": 2,
            "linecolor": "white",
            "showbackground": true,
            "ticks": "",
            "zerolinecolor": "white"
           },
           "zaxis": {
            "backgroundcolor": "#E5ECF6",
            "gridcolor": "white",
            "gridwidth": 2,
            "linecolor": "white",
            "showbackground": true,
            "ticks": "",
            "zerolinecolor": "white"
           }
          },
          "shapedefaults": {
           "line": {
            "color": "#2a3f5f"
           }
          },
          "ternary": {
           "aaxis": {
            "gridcolor": "white",
            "linecolor": "white",
            "ticks": ""
           },
           "baxis": {
            "gridcolor": "white",
            "linecolor": "white",
            "ticks": ""
           },
           "bgcolor": "#E5ECF6",
           "caxis": {
            "gridcolor": "white",
            "linecolor": "white",
            "ticks": ""
           }
          },
          "title": {
           "x": 0.05
          },
          "xaxis": {
           "automargin": true,
           "gridcolor": "white",
           "linecolor": "white",
           "ticks": "",
           "title": {
            "standoff": 15
           },
           "zerolinecolor": "white",
           "zerolinewidth": 2
          },
          "yaxis": {
           "automargin": true,
           "gridcolor": "white",
           "linecolor": "white",
           "ticks": "",
           "title": {
            "standoff": 15
           },
           "zerolinecolor": "white",
           "zerolinewidth": 2
          }
         }
        },
        "title": {
         "font": {
          "color": "#1F2937",
          "family": "Helvetica Neue, Arial, sans-serif"
         },
         "text": "Cost Breakdown (Three-Year, Risk-Adjusted)"
        }
       }
      },
      "image/png": "[encoded data, 59524 characters]"
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "charts.cost_breakdown_pie(seed.COSTS).show()"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "g2-md-ai-callout",
   "metadata": {},
   "source": [
    "## Why the AI-tokens line matters\n",
    "\n",
    "Genesys bills AI consumption in *AI Experience tokens* \u2014 pricing is\n",
    "tiered, capability-dependent, and deal-specific. The Forrester study\n",
    "modelled **\\$0** of AI consumption even though benefits **Bt**, **Ct**\n",
    "and **Dt** all rely on AI features that draw tokens:\n",
    "\n",
    "- **Bt** Self-service uplift (15\u219225%) \u2014 voice/digital virtual agents\n",
    "- **Ct** Agent efficiency (MTTR -2 min) \u2014 real-time AI coaching/assist\n",
    "- **Dt** Agent-assist incremental sales \u2014 next-best-action suggestions\n",
    "\n",
    "For sizing context, the study's own drivers imply ~1.04M self-service\n",
    "interactions/yr (B5 \u00d7 52) and ~3.12M agent-assisted interactions/yr\n",
    "(C1 \u00d7 52) would draw tokens. Athena stores a single annual cost value\n",
    "per cost line, and so does the seed \u2014 enter the negotiated annual\n",
    "figure from the Genesys quote in `03_business_case.ipynb` and document\n",
    "the quote details (volume, unit price, tier) in the field notes."
   ]
  },
  {
   "cell_type": "markdown",
   "id": "g2-md-push",
   "metadata": {},
   "source": [
    "## Push to Athena (optional)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "id": "g2-code-push",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div style=\"padding:10px 14px;border-left:4px solid #0277bd;background:#e1f5fe;color:#1a1a1a;border-radius:4px;margin:6px 0;\">No PALLADIUM_GENESYSCX_TOOL_PUBLIC_ID set \u2014 skipped Athena push.</div>"
      ],
      "text/plain": [
       "<IPython.core.display.HTML object>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "if config.TOOL_PUBLIC_ID:\n",
    "    from core.tei_client import TEIClient\n",
    "\n",
    "    client = TEIClient()\n",
    "    # Push pre-multiplied by (1 + risk_adj) per Palladium convention\n",
    "    payload = []\n",
    "    for c in seed.COSTS:\n",
    "        f = 1 + c['risk_adjustment']\n",
    "        payload.append({\n",
    "            'field_key': c['field_key'],\n",
    "            'year_values': {y: round(v * f, 2) for y, v in c['year_values'].items()},\n",
    "            'initial': round((c.get('initial') or 0) * f, 2),\n",
    "            'notes': c['notes'],\n",
    "        })\n",
    "    client.update_values(config.TOOL_PUBLIC_ID, payload)\n",
    "    display.alert(f'Pushed {len(payload)} cost rows to '\n",
    "                  f'tool <code>{config.TOOL_PUBLIC_ID}</code>.', 'success')\n",
    "else:\n",
    "    display.alert('No PALLADIUM_GENESYSCX_TOOL_PUBLIC_ID set \u2014 skipped Athena push.', 'info')"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "g2-md-next",
   "metadata": {},
   "source": [
    "Continue with [`03_business_case.ipynb`](03_business_case.ipynb) \u2192"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "e1507f5a-3a42-4c9e-bbce-a86ff1a1dbb7",
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3 (ipykernel)",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.12.7"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
