#!/usr/bin/env python3
"""Verify published and held rows for AIPA-HOLD-20260823."""

from __future__ import annotations

import csv
import pathlib
import sys


def main() -> int:
    path = pathlib.Path(__file__).with_name("band-output-AIPA-HOLD-20260823.csv")
    with path.open(newline="", encoding="utf-8") as handle:
        rows = list(csv.DictReader(handle))
    rates = [row["voluntary_attrition_pct"] for row in rows if row["status"] == "published"]
    held = [row for row in rows if row["status"].startswith("suppressed_")]
    if rates != ["6.1", "8.4"] or len(held) != 3:
        print("FAIL: rates or held-row count is incorrect.", file=sys.stderr)
        return 1
    if any(row["voluntary_attrition_pct"] for row in held):
        print("FAIL: a held row exposes a rate.", file=sys.stderr)
        return 1
    print("OK: two rates and three blank held rows verified.")
    return 0


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