#!/usr/bin/env python3
"""Verify illustrative plan gaps for HCP-PLANV4-20260823."""

from __future__ import annotations

import csv
import pathlib
import sys


def main() -> int:
    path = pathlib.Path(__file__).with_name("plan-gap-HCP-PLANV4-20260823.csv")
    with path.open(newline="", encoding="utf-8") as handle:
        rows = list(csv.DictReader(handle))
    published = [(row["band"], row["plan_fte"], row["on_role_fte"], row["gap_fte"]) for row in rows if row["status"] == "published"]
    expected = [("Staff", "90", "84", "-6"), ("Senior", "41", "41", "0"), ("Manager", "12", "12", "0")]
    held = [row for row in rows if row["status"].startswith("suppressed_")]
    if published != expected or len(held) != 3:
        print("FAIL: plan gaps or held-row count is incorrect.", file=sys.stderr)
        return 1
    if any(row["plan_fte"] or row["on_role_fte"] or row["gap_fte"] for row in held):
        print("FAIL: a held row exposes a value.", file=sys.stderr)
        return 1
    print("OK: three plan gaps and three blank held rows verified.")
    return 0


if __name__ == "__main__":
    raise SystemExit(main())
