import sys
import os
import json

AI_ENGINE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
sys.path.insert(0, AI_ENGINE_DIR)

from services.single_match_orchestrator import get_single_match_orchestrator
from dotenv import load_dotenv

load_dotenv()

if len(sys.argv) < 2:
    print("Match ID needed.")
    sys.exit(1)

match_id = sys.argv[1].strip()
orch = get_single_match_orchestrator()

result = orch.analyze_match(match_id)

print(json.dumps(result, indent=2, ensure_ascii=False))
