#!/usr/bin/env python3
"""
Check that the theorem submission bundle is present in the expected location.

Usage:
  python tools/check_theorem_bundle_present.py
"""

from __future__ import annotations
import os, sys

REQUIRED = [
  "sources/theorem_submission_v19/rigidity_gapfree_global/rigidity_gapfree_global_universality.pdf",
  "sources/theorem_submission_v19/rigidity_gapfree_global/global_universality_theorems.tex",
  "sources/theorem_submission_v19/rigidity_gapfree_global/contraction_from_doeblin.tex",
  "sources/theorem_submission_v19/rigidity_gapfree_global/robust_certificate_schema.json",
  "sources/theorem_submission_v19/rigidity_gapfree_global/global_universality_report_schema.json",
]

def main()->int:
    root=os.path.abspath(os.path.join(os.path.dirname(__file__), ".."))
    missing=[]
    for rel in REQUIRED:
        p=os.path.join(root, rel.replace("/", os.sep))
        if not os.path.exists(p):
            missing.append(rel)
    if missing:
        print("MISSING THEOREM BUNDLE FILES")
        for m in missing:
            print("-", m)
        return 2
    print("THEOREM BUNDLE PRESENT")
    return 0

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