"""Verify genesis-voice-bridge public endpoints."""
import urllib.request
import json
import ssl

ctx = ssl.create_default_context()
ctx.check_hostname = False
ctx.verify_mode = ssl.CERT_NONE

endpoints = [
    ("http://91.99.89.7:8900/health",                          "Direct IP port 8900"),
    ("https://api.sunaivadigital.com/health",                  "Sunaiva API /health"),
    ("https://api.sunaivadigital.com/voice-bridge/health",     "Sunaiva /voice-bridge/health"),
    ("https://api.sunaivadigital.com/mcp/health",              "Sunaiva /mcp/health"),
]

for url, label in endpoints:
    try:
        req = urllib.request.Request(url, headers={"User-Agent": "Genesis/1.0"})
        with urllib.request.urlopen(req, timeout=8, context=ctx) as r:
            body = r.read(500).decode("utf-8", errors="replace")
            print(f"[OK]   {label}")
            print(f"       URL: {url}")
            print(f"       Status: {r.status}")
            print(f"       Body: {body[:200]}")
    except Exception as e:
        print(f"[FAIL] {label}")
        print(f"       URL: {url}")
        print(f"       Error: {e}")
    print()
