# Generated by smithplates HTTP codegen. Do not edit.

from __future__ import annotations

from generated.example.pong import Pong
from generated.example.room_joined import RoomJoined
from generated.example.server_error import ServerError
from generated.example.welcome import Welcome
from pydantic import BaseModel, TypeAdapter


class ServerMessageWelcome(BaseModel):
    welcome: Welcome


class ServerMessageRoomJoined(BaseModel):
    roomJoined: RoomJoined


class ServerMessagePong(BaseModel):
    pong: Pong


class ServerMessageError(BaseModel):
    error: ServerError


ServerMessage = ServerMessageWelcome | ServerMessageRoomJoined | ServerMessagePong | ServerMessageError


_ServerMessage_ADAPTER = TypeAdapter(ServerMessage)


def validate_server_message(value: object) -> ServerMessage:
    return _ServerMessage_ADAPTER.validate_python(value)
