diff --git a/src/mind_reader/state_machines/lobby/domain.py b/src/mind_reader/state_machines/lobby/domain.py index 27b35a2..612fd9f 100644 --- a/src/mind_reader/state_machines/lobby/domain.py +++ b/src/mind_reader/state_machines/lobby/domain.py @@ -11,3 +11,9 @@ class PlayerRole(StrEnum): class Player: name: str role: PlayerRole + + @classmethod + def from_dict(cls, d: dict) -> "Player": + return cls( + name=d["player"]["name"], role=PlayerRole(d["player"]["role"]) + )