"""GLEE public research note 001, 2026-10-15. Python 3, standard library only.

Run: python3 canada-capacity-model-20261015.py
Every site parameter is illustrative. No national gain or empirical return is
estimated. Extra review labour scales per unit. Payroll is held fixed. Values
are pre-tax, unlevered CAD2026 assumptions; zero terminal value, 8% real discount.
"""
import json


def scenario(share=.40, speed=2., review=.025, headroom=.15,
             upfront=600000, annual_fixed=35000):
    if not (0 <= share <= 1 and speed >= 1 and review >= 0 and headroom >= 0):
        raise ValueError('Invalid assumptions')
    hours_per_unit = 1-share+share/speed+review
    potential = 1/hours_per_unit-1
    realized = min(potential, headroom)
    extra_units = 100000*realized
    annual_margin_per_extra_unit = 8-.5*.10
    cash_flows = [extra_units*annual_margin_per_extra_unit*(.5 if y==1 else 1)-annual_fixed for y in range(1,11)]
    return {'assumption_status':'illustrative_not_observed',
            'labour_limited_output_gain':potential,'realized_output_gain':realized,
            'npv_CAD2026':-upfront+sum(cf/1.08**year for year,cf in enumerate(cash_flows,1))}


if __name__=='__main__':
    print(json.dumps({'conservative':scenario(.30,1.5,.03,.03),
                      'central':scenario(),
                      'optimistic':scenario(.50,3.,.02,.35),
                      'process_comparator':scenario(.20,1.5,.01,.05,50000,5000),
                      'zero_headroom':scenario(headroom=0)},indent=2))
