#!/usr/bin/env python3
"""Score APLD strategic research hypotheses from current evidence."""

from __future__ import annotations

import csv
from pathlib import Path

BASE = Path(__file__).resolve().parent
HYP = BASE / "apld_research_hypotheses.csv"
OUT = BASE / "apld_thesis_scores.csv"

SCORES = {
    "H1": (7, "One clean delivery pair exists; future buildings remain pending."),
    "H2": (9, "Capacity categories clearly show contracted MW leads delivered MW."),
    "H3": (6, "HPC revenue started, but revenue-to-capacity mapping is still sparse."),
    "H4": (8, "Large cash, debt and property-investment disclosures show financing sensitivity."),
}


def main() -> None:
    rows = list(csv.DictReader(HYP.open(newline="", encoding="utf-8")))
    out = []
    for row in rows:
        score, reason = SCORES[row["hypothesis_id"]]
        out.append({**row, "score_1_10": str(score), "score_reason": reason})
    with OUT.open("w", newline="", encoding="utf-8") as f:
        writer = csv.DictWriter(f, fieldnames=list(out[0]))
        writer.writeheader()
        writer.writerows(out)
    print(f"wrote {len(out)} thesis scores")


if __name__ == "__main__":
    main()
