#!/usr/bin/env python3
"""RolloutDesk license math.

Computes every figure printed on /noise-suppression-license-costs/ so no
number on that page is hand-typed. Inputs are list prices verified on
krisp.ai/pricing on 2026-09-20:

  Krisp Core      $8 /user/mo billed annually   ($16 month-to-month)
  Krisp Advanced  $15/user/mo billed annually   ($30 month-to-month)
  Krisp CC Core   $15/agent/mo billed annually
  Krisp Enterprise: custom pricing (not computable here)

Run:  python3 tools/license-math.py
Paste the emitted HTML rows / sentences into the costs page verbatim.
"""

PLANS = {
    "core_annual": 8,
    "core_monthly": 16,
    "adv_annual": 15,
    "adv_monthly": 30,
    "cc_core_annual": 15,
}

SEATS = [25, 50, 100, 250, 500, 1000]


def money(n: int) -> str:
    return f"${n:,}"


def main() -> None:
    print("== Annual spend by seat count (12 months) ==\n")
    print("<!-- generated by tools/license-math.py — do not hand-edit figures -->")
    print("<tr><th>Seats</th><th>Core, annual billing</th>"
          "<th>Core, month-to-month</th><th>Advanced, annual billing</th>"
          "<th>Advanced, month-to-month</th></tr>")
    for s in SEATS:
        core_a = s * PLANS["core_annual"] * 12
        core_m = s * PLANS["core_monthly"] * 12
        adv_a = s * PLANS["adv_annual"] * 12
        adv_m = s * PLANS["adv_monthly"] * 12
        print(f"<tr><td>{s:,}</td><td>{money(core_a)}</td><td>{money(core_m)}</td>"
              f"<td>{money(adv_a)}</td><td>{money(adv_m)}</td></tr>")

    print("\n== Computed sentences ==\n")
    s = 100
    core_a = s * PLANS["core_annual"] * 12
    core_m = s * PLANS["core_monthly"] * 12
    print(f"- 100 seats on Core: {money(core_a)}/yr annual-billed vs "
          f"{money(core_m)}/yr month-to-month → forgetting annual billing costs "
          f"{money(core_m - core_a)}/yr.")
    adv_a = s * PLANS["adv_annual"] * 12
    print(f"- 100 seats, Advanced vs Core (both annual): {money(adv_a)} vs "
          f"{money(core_a)} → the Advanced delta is {money(adv_a - core_a)}/yr.")
    s = 250
    core_a = s * PLANS["core_annual"] * 12
    print(f"- 250 seats on Core annual: {money(core_a)}/yr "
          f"({money(PLANS['core_annual'] * 12)}/seat/yr).")
    cc = 50 * PLANS["cc_core_annual"] * 12
    print(f"- 50-agent support desk on CC Core: {money(cc)}/yr "
          f"({money(PLANS['cc_core_annual'] * 12)}/agent/yr).")
    pct = round((1 - PLANS["core_annual"] / PLANS["core_monthly"]) * 100)
    print(f"- Annual billing discount on Core and Advanced: {pct}% off the "
          f"month-to-month rate.")
    print(f"- Per-seat yearly: Core annual {money(PLANS['core_annual']*12)}, "
          f"Core monthly {money(PLANS['core_monthly']*12)}, "
          f"Advanced annual {money(PLANS['adv_annual']*12)}, "
          f"Advanced monthly {money(PLANS['adv_monthly']*12)}.")


if __name__ == "__main__":
    main()
