#!/usr/bin/env python3
"""Verify illustrative cohort queue ATTR-TENURE-20260823."""

from __future__ import annotations

import csv
import pathlib
import sys


def main() -> int:
    path = pathlib.Path(__file__).with_name("cohort-queue-ATTR-TENURE-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"] == "suppressed_n_under_5"]
    if rates != ["6.1", "8.4"] or len(held) != 2:
        print("FAIL: rates or suppressed-row count is incorrect.", file=sys.stderr)
        return 1
    if any(row["voluntary_attrition_pct"] for row in held):
        print("FAIL: a suppressed row exposes a rate.", file=sys.stderr)
        return 1
    print("OK: two rates and two blank suppressed rows verified.")
    return 0


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