"""Socket.IO module for real-time game communication.

This module provides WebSocket-based real-time communication for:
- Active game sessions (actions, state updates, turn notifications)
- Connection management with session recovery
- Turn timeout handling
- JWT-based authentication

Architecture:
    - Uses python-socketio with ASGI mode for FastAPI integration
    - /game namespace handles all active game communication
    - /lobby namespace (Phase 6) will handle matchmaking
    - JWT authentication on connect (WS-004)

Usage:
    The Socket.IO server is mounted alongside FastAPI in app/main.py.
    Clients connect to ws://host/socket.io/ and join the /game namespace.

    Client connection example:
        socket = io("ws://host", {
            auth: { token: "JWT_ACCESS_TOKEN" }
        });
"""

from app.socketio.auth import (
    AuthHandler,
    AuthResult,
    auth_handler,
    extract_token,
    get_session_user_id,
    require_auth,
)
from app.socketio.server import create_socketio_app, sio

__all__ = [
    # Server
    "create_socketio_app",
    "sio",
    # Auth
    "AuthHandler",
    "AuthResult",
    "auth_handler",
    "extract_token",
    "get_session_user_id",
    "require_auth",
]
