from pathlib import Path
import json,sys
from gate_rules import inspect_case,expected_case,inspect_transfer,expected_transfer
ROOT=Path(__file__).resolve().parent
if len(sys.argv)!=2:
    raise SystemExit('usage: python run_checks.py <fixture.json>')
p=Path(sys.argv[1])
if not p.is_absolute(): p=(ROOT/p).resolve()
f=json.loads(p.read_text(encoding='utf-8'))
if 'transfer' in p.parts:
    issues=inspect_transfer(f); state=expected_transfer(f)
else:
    issues=inspect_case(f); state=expected_case(f)
print(json.dumps({'fixture':f.get('fixture_id'),'state':state,'issues':issues,'legal_advice':False,'synthetic_only':True},ensure_ascii=False,indent=2))
