#!/usr/bin/env python3
"""
Setup script to help users configure their environment variables.
This script will copy .env.example to .env and prompt for values.
"""

import os
import shutil
from pathlib import Path

def setup_environment():
    """Setup environment variables for the application"""
    
    # Get the directory where this script is located
    script_dir = Path(__file__).parent
    env_example_path = script_dir / '.env.example'
    env_path = script_dir / '.env'
    
    # Check if .env.example exists
    if not env_example_path.exists():
        print("❌ .env.example file not found!")
        print("Please create a .env.example file with the required environment variables.")
        return False
    
    # Check if .env already exists
    if env_path.exists():
        response = input("⚠️  .env file already exists. Do you want to overwrite it? (y/N): ")
        if response.lower() != 'y':
            print("Setup cancelled.")
            return False
    
    # Copy .env.example to .env
    try:
        shutil.copy2(env_example_path, env_path)
        print("✅ Created .env file from .env.example")
        print("\n📝 Please edit the .env file with your actual values:")
        print(f"   {env_path}")
        print("\n🔑 You'll need to fill in the following key values:")
        print("   - API keys (OpenAI, TogetherAI, Firebase, etc.)")
        print("   - Database credentials")
        print("   - Milvus configuration")
        print("   - Auth0 settings")
        print("   - Stripe keys")
        return True
    except Exception as e:
        print(f"❌ Error creating .env file: {e}")
        return False

if __name__ == "__main__":
    setup_environment() 