#!/usr/bin/env python3
"""Render the preregistered phase-factorial hypothesis schematic (mock data)."""

from __future__ import annotations

from pathlib import Path

import matplotlib

matplotlib.use("Agg")
import matplotlib.pyplot as plt


def main() -> None:
    labels = ("235B\nprefill-only", "235B\nmixed", "30B\nprefill-only", "30B\nmixed")
    x = range(len(labels))
    phase_hypothesis = (1.0, 18.0, 2.0, 28.0)
    stack_hypothesis = (1.0, 4.0, 24.0, 30.0)

    fig, ax = plt.subplots(figsize=(8.6, 4.8), constrained_layout=True)
    ax.plot(x, phase_hypothesis, marker="o", lw=2, label="H-phase (mock)")
    ax.plot(x, stack_hypothesis, marker="s", lw=2, label="H-stack (mock)")
    ax.axhline(5, color="black", ls="--", lw=1.2, label="5% regret gate")
    ax.set_xticks(list(x), labels)
    ax.set_ylabel("Worst selected-config regret (%) — MOCK DATA")
    ax.set_title("Schematic only: predictions that distinguish phase vs stack explanations")
    ax.set_ylim(0, 35)
    ax.grid(axis="y", alpha=0.25)
    ax.legend()
    ax.text(
        0.01,
        0.98,
        "MOCK DATA / NOT A RESULT",
        transform=ax.transAxes,
        va="top",
        color="crimson",
        weight="bold",
    )
    output = Path(__file__).with_name("mock-phase-factorial.png")
    fig.savefig(output, dpi=180)
    print(output)


if __name__ == "__main__":
    main()
