#!/usr/bin/env python3
"""Verify illustrative complement-hold outputs for PAP-COMPLEMENT-20260823."""

from __future__ import annotations

import csv
import pathlib
import sys


def main() -> int:
    path = pathlib.Path(__file__).with_name("hold-output-PAP-COMPLEMENT-20260823.csv")
    with path.open(newline="", encoding="utf-8") as handle:
        rows = list(csv.DictReader(handle))
    rates = [row["value"] for row in rows if row["status"] == "published"]
    blocked = [row for row in rows if row["status"] == "blocked_parent_exposed_complement"]
    held = [row for row in rows if row["status"].startswith("suppressed_")]
    if rates != ["6.1", "8.4"] or len(blocked) != 1 or blocked[0]["value"] != "6":
        print("FAIL: rates or blocked parent do not match the desk log.", file=sys.stderr)
        return 1
    if len(held) != 2 or any(row["value"] for row in held):
        print("FAIL: held rows are not blank.", file=sys.stderr)
        return 1
    print("OK: two rates, one blocked parent, and two blank holds verified.")
    return 0


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