#!/usr/bin/env python3
"""Verify the illustrative five-page pack index for MRP-REPLAY-20260823."""

from __future__ import annotations

import csv
import pathlib
import sys

EXPECTED = {
    "opex_drivers": "360",
    "cash_interest": "in_line",
    "gross_margin": "-140",
    "mapping_review": "25",
    "residual_review": "18",
}


def main() -> int:
    path = pathlib.Path(__file__).with_name("pack-index-MRP-REPLAY-20260823.csv")
    with path.open(newline="", encoding="utf-8") as handle:
        rows = list(csv.DictReader(handle))
    observed = {
        row["page_id"]: row["value_usd_k_or_status"]
        for row in rows
    }
    if observed != EXPECTED:
        print("FAIL: pack index does not match the desk log.", file=sys.stderr)
        return 1
    print("OK: five-page illustrative pack index matches the desk log.")
    return 0


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