#!/usr/bin/env python3
"""Projection, not results: what spec-first cold outreach could return per batch.
Python 3 stdlib only.  Usage: python3 funnel_projection.py [prospects]

Reply rates are public benchmarks (read December 4, 2026). Their denominators differ,
and here each is treated as the share of prospects who reply across the 3-touch
sequence. That treatment is an assumption. The other rates are my assumptions.
"""
import sys

SCENARIOS = [  # (name, reply rate, source)
    ("Low", 0.0072, "Belkins 2026 study, companies with 0 to 10 employees"),
    ("Base", 0.0343, "Instantly Cold Email Benchmark Report 2026, average"),
    ("High", 0.107, "Instantly 2026, top-10% threshold"),
]
POSITIVE_SHARE = 0.50   # assumption: share of replies that want to talk or buy
CLOSE_RATE = 0.35       # assumption: share of positive replies that pay an invoice
AVG_ORDER = 140         # assumption: the 3-ad pack is the typical first order (USD)
HOURLY_TARGET = 40      # assumption: same hourly value as piece 10 (USD per hour)


def main():
    prospects = int(sys.argv[1]) if len(sys.argv) > 1 else 25
    print(f"PROJECTION for {prospects} prospects | positive {POSITIVE_SHARE:.0%} | "
          f"close {CLOSE_RATE:.0%} | first order ${AVG_ORDER}")
    print(f"{'Scenario':<6}{'Reply':>8}{'Replies':>9}{'Orders':>8}{'Revenue':>9}"
          f"{'Prospects/order':>17}{'$/prospect':>12}")
    for name, rate, _ in SCENARIOS:
        replies = prospects * rate
        orders = replies * POSITIVE_SHARE * CLOSE_RATE
        per_order = 1 / (rate * POSITIVE_SHARE * CLOSE_RATE)
        print(f"{name:<6}{rate:>8.2%}{replies:>9.2f}{orders:>8.2f}{orders * AVG_ORDER:>9.0f}"
              f"{per_order:>17.0f}{orders * AVG_ORDER / prospects:>12.2f}")
    print(f"Break-even reply rate to earn ${HOURLY_TARGET}/hour on spec-ad build time (first order only):")
    for minutes in (10, 15, 45):
        need = HOURLY_TARGET * minutes / 60 / (POSITIVE_SHARE * CLOSE_RATE * AVG_ORDER)
        verdict = f"{need:.1%} of prospects must reply" if need <= 1 else "not reachable (over 100%)"
        print(f"  {minutes} min per spec ad -> {verdict}")
    print("Sources:", "; ".join(f"{n} = {s}" for n, _, s in SCENARIOS))


if __name__ == "__main__":
    main()
