from __future__ import annotations

import argparse
import json
from pathlib import Path


def main() -> int:
    ap = argparse.ArgumentParser()
    ap.add_argument("--json", required=True)
    args = ap.parse_args()
    payload = json.loads(Path(args.json).read_text(encoding="utf-8"))
    ok = int(payload.get("replay_used_as_live_count", 1)) == 0
    print(json.dumps({
        "formula_id": "NO_REPLAY_LIVE_MIX_V1",
        "gate": "PASS" if ok else "FAIL",
        "replay_used_as_live_count": payload.get("replay_used_as_live_count", -1),
    }, ensure_ascii=True, indent=2))
    return 0 if ok else 1


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