#!/usr/bin/env python3
"""
Test script to verify uv setup and environment loading
"""

import sys
from pathlib import Path

# Add src to path
sys.path.insert(0, str(Path(__file__).parent / "src"))

from config import config, Config

def main():
    print("🧪 Testing Trax Configuration with uv")
    print("=" * 50)
    
    # Display configuration status
    config.display_config_status()
    
    # Test API key access
    print("\n🔑 Testing API Key Access:")
    print("-" * 40)
    
    test_keys = [
        ("ANTHROPIC_API_KEY", config.ANTHROPIC_API_KEY),
        ("DEEPSEEK_API_KEY", config.DEEPSEEK_API_KEY),
        ("OPENROUTER_API_KEY", config.OPENROUTER_API_KEY),
        ("GOOGLE_CLIENT_ID", config.GOOGLE_CLIENT_ID),
        ("DIRECTUS_URL", config.DIRECTUS_URL),
    ]
    
    for key_name, key_value in test_keys:
        if key_value:
            # Show first 10 chars for security
            preview = key_value[:10] + "..." if len(key_value) > 10 else key_value
            print(f"✅ {key_name}: {preview}")
        else:
            print(f"❌ {key_name}: Not found")
    
    # Test validation
    print("\n🔍 Testing Validation:")
    print("-" * 40)
    
    required = ["ANTHROPIC_API_KEY", "DEEPSEEK_API_KEY"]
    if config.validate_required_keys(required):
        print("✅ All required keys present")
    else:
        print("❌ Some required keys missing")
    
    print("\n✅ Configuration test complete!")
    print(f"📦 Running with uv in: {Path(__file__).parent}")

if __name__ == "__main__":
    main()