"""Run every chart module, produce the webinar deck PNG set.

Usage:
  python cecl_benchmark_webinar_export.py --shortqtr=1q26 --compare=4q25 --out /tmp/webinar_1q26/
"""
from __future__ import annotations
import argparse
from pathlib import Path

from webinar_charts.bank_settings import (
    plot_cohort_summary,
    plot_settings_distributions,
    plot_categorical_usage,
)
from webinar_charts.forward_looking import plot_top_locked_codes
from webinar_charts.themes import plot_themes
from webinar_charts.pool_deep_dive import plot_pool_box
from webinar_charts.what_changed import plot_what_changed


def main() -> None:
    ap = argparse.ArgumentParser()
    ap.add_argument("--shortqtr", required=True)
    ap.add_argument("--compare", required=True, help="prior shortqtr for what-changed slide")
    ap.add_argument("--out", required=True)
    args = ap.parse_args()

    out_dir = Path(args.out)
    out_dir.mkdir(parents=True, exist_ok=True)
    print(f"Writing charts to {out_dir}")

    plot_cohort_summary(args.shortqtr, out_dir)
    plot_settings_distributions(args.shortqtr, out_dir)
    plot_categorical_usage(args.shortqtr, out_dir)
    plot_top_locked_codes(args.shortqtr, out_dir)
    plot_themes(args.shortqtr, out_dir)
    plot_pool_box(args.shortqtr, out_dir)
    plot_what_changed(args.shortqtr, args.compare, out_dir)

    print(f"\nDone. Files in {out_dir}:")
    for p in sorted(out_dir.glob("*.png")):
        print(f"  {p.name}")


if __name__ == "__main__":
    main()
