#!/usr/bin/env python3
"""Verify published aggregate rows for desk log AIDB-CREATOR-QUESTION-20260825.

This script checks the first-party illustrative CSV only. It does not
reconstruct the catalog-click versus decision-question scenario, and it
is not a third-party reproduction or a statistical benchmark.
"""

from __future__ import annotations

import csv
import pathlib
import sys

EXPECTED = [
    {
        "state": "catalog_click",
        "catalog_tiles": "6",
        "answering_charts": "0",
        "exception_memo": "0",
        "inspectable_lineage": "no",
        "rerunnable": "no",
        "reviewer_opened": "no",
    },
    {
        "state": "first_party_decision_question",
        "catalog_tiles": "0",
        "answering_charts": "3",
        "exception_memo": "1",
        "inspectable_lineage": "yes",
        "rerunnable": "yes",
        "reviewer_opened": "yes",
    },
]


def main() -> int:
    csv_path = pathlib.Path(__file__).with_name(
        "aggregate-AIDB-CREATOR-QUESTION-20260825.csv"
    )
    with csv_path.open(newline="", encoding="utf-8") as handle:
        rows = list(csv.DictReader(handle))
    if rows != EXPECTED:
        print("FAIL: published aggregate rows do not match the desk log.", file=sys.stderr)
        return 1
    print("OK: published illustrative rows match desk log AIDB-CREATOR-QUESTION-20260825.")
    return 0


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