#!/usr/bin/env python3
from api.client import SpotifyClient
from ui.interactive_menu import InteractiveMenu
from ui.profile_display import ProfileDisplay


def main():
    display = ProfileDisplay()
    
    try:
        display.show_loading("Connecting to Spotify and loading your data...")
        
        client = SpotifyClient()
        user_profile = client.get_user_profile()
        user_playlists = client.get_user_playlists()
        
        # Start interactive menu
        interactive_menu = InteractiveMenu(user_profile, user_playlists, client)
        interactive_menu.run()
        
    except ValueError as e:
        display.show_error(str(e), error_type="config")
    except Exception as e:
        display.show_error(str(e), error_type="auth")


if __name__ == "__main__":
    main()