"""
Script de démonstration des thèmes GUI
Lance chaque thème l'un après l'autre
"""

import os
import sys
import time


def clear_screen():
    """Efface l'écran."""
    os.system('cls' if os.name == 'nt' else 'clear')


def print_banner(theme_name):
    """Affiche une bannière pour le thème."""
    banner = f"""
    ╔═══════════════════════════════════════╗
    ║     Web Sentinel - Thème {theme_name:<9}║
    ╔═══════════════════════════════════════╗
    """
    print(banner)


def demo_theme(theme_name, module_path):
    """Démonstration d'un thème."""
    clear_screen()
    print_banner(theme_name)
    print(f"\n🚀 Lancement du thème {theme_name}...")
    print(f"📦 Module: {module_path}")
    print("\n💡 Fermez la fenêtre pour passer au thème suivant")
    print("⌨️  Ou appuyez sur Ctrl+C pour quitter\n")
    
    time.sleep(2)
    
    # Lancer le thème
    os.system(f"python -m {module_path}")


def main():
    """Lance la démo des thèmes."""
    themes = [
        ("DARK", "web_sentinel.gui.themes_gui.dark_window"),
        ("CYBERPUNK", "web_sentinel.gui.themes_gui.cyberpunk_window"),
        ("MINIMAL", "web_sentinel.gui.themes_gui.minimal_window"),
    ]
    
    clear_screen()
    print("""
    ╔════════════════════════════════════════════════╗
    ║  WEB SENTINEL - DÉMONSTRATION DES THÈMES GUI  ║
    ╚════════════════════════════════════════════════╝
    
    Cette démo va lancer les 3 nouveaux thèmes :
    
    🌑 DARK       - Design moderne sombre et élégant
    ⚡ CYBERPUNK  - Esthétique futuriste avec néons
    ☀️ MINIMAL    - Design épuré et minimaliste
    
    Chaque thème s'ouvrira automatiquement.
    Fermez la fenêtre pour passer au suivant.
    
    Appuyez sur Entrée pour commencer...
    """)
    
    input()
    
    try:
        for theme_name, module_path in themes:
            demo_theme(theme_name, module_path)
            time.sleep(1)
        
        clear_screen()
        print("""
    ╔════════════════════════════════════════╗
    ║     DÉMONSTRATION TERMINÉE !          ║
    ╚════════════════════════════════════════╝
    
    ✅ Vous avez testé les 3 nouveaux thèmes !
    
    Pour utiliser un thème :
    
    1. Via variable d'environnement :
       $env:WS_GUI_THEME="dark"
       python -m web_sentinel.gui.theme_launcher
    
    2. Via configuration :
       Modifiez ~/.web-sentinel/gui-config.json
       {"gui_theme": "cyberpunk"}
    
    3. Depuis l'interface :
       Bouton "Thème" → Entrez le nom du thème
    
    Thèmes disponibles :
    - classic    (GUI original)
    - dark       (moderne sombre)
    - cyberpunk  (futuriste néon)
    - minimal    (épuré clair)
    
    📖 Documentation complète : docs/GUI_THEMES_NEW.md
    
        """)
    
    except KeyboardInterrupt:
        print("\n\n❌ Démonstration interrompue par l'utilisateur")
        sys.exit(0)


if __name__ == "__main__":
    main()
