import requests
import json

BASE_URL = "http://127.0.0.1:8001/fs-ai-asistant/api/workflow/lawrisk/v2"

def test_themes():
    print("Testing /v2/themes...")
    url = f"{BASE_URL}/themes"
    resp = requests.get(url)
    print(f"Status: {resp.status_code}")
    data = resp.json()
    print(f"Success: {data.get('success')}")
    if data.get('success'):
        themes = data['data'].get('themes', [])
        print(f"Found {len(themes)} themes.")
        if themes:
            print(f"Sample: {themes[0]}")

def test_unbound():
    print("\nTesting /v2/unbound-permits...")
    url = f"{BASE_URL}/unbound-permits"
    resp = requests.get(url)
    print(f"Status: {resp.status_code}")
    data = resp.json()
    print(f"Success: {data.get('success')}")
    if data.get('success'):
        permits = data['data'].get('permits', [])
        print(f"Found {len(permits)} unbound permits.")
        if permits:
            print(f"Sample: {permits[0]}")

if __name__ == "__main__":
    try:
        test_themes()
        test_unbound()
    except Exception as e:
        print(f"Test failed: {e}")
