""" This file is part of the SplendidBear Websites' projects. Copyright (c) 2026 @ www.splendidbear.org For the full copyright and license information, please view the LICENSE file that was distributed with this source code. """ from __future__ import annotations from dataclasses import dataclass, field @dataclass class Session: """Holds the current player's identity and game association.""" # Username (real user) or "anon_" for guests username: str = "" # Whether this is an authenticated (non-guest) user is_authenticated: bool = False # Current game association UUID game_assoc: str = "" # "red" or "blue" — assigned when both players are subscribed color: str = "" # Mercure subscriber JWT for the current game mercure_jwt: str = "" # Module-level singleton; reset on logout _session: Session = Session() def get() -> Session: return _session def reset() -> None: global _session _session = Session()