# coding: utf-8

"""
    Jellyfin API

    No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)

    The version of the OpenAPI document: 10.11.0
    Generated by OpenAPI Generator (https://openapi-generator.tech)

    Do not edit the class manually.
"""  # noqa: E501


from __future__ import annotations
import json
import pprint
from pydantic import BaseModel, ConfigDict, Field, StrictStr, ValidationError, field_validator
from typing import Any, List, Optional
from openapi_client.models.activity_log_entry_message import ActivityLogEntryMessage
from openapi_client.models.force_keep_alive_message import ForceKeepAliveMessage
from openapi_client.models.general_command_message import GeneralCommandMessage
from openapi_client.models.library_changed_message import LibraryChangedMessage
from openapi_client.models.outbound_keep_alive_message import OutboundKeepAliveMessage
from openapi_client.models.play_message import PlayMessage
from openapi_client.models.playstate_message import PlaystateMessage
from openapi_client.models.plugin_installation_cancelled_message import PluginInstallationCancelledMessage
from openapi_client.models.plugin_installation_completed_message import PluginInstallationCompletedMessage
from openapi_client.models.plugin_installation_failed_message import PluginInstallationFailedMessage
from openapi_client.models.plugin_installing_message import PluginInstallingMessage
from openapi_client.models.plugin_uninstalled_message import PluginUninstalledMessage
from openapi_client.models.refresh_progress_message import RefreshProgressMessage
from openapi_client.models.restart_required_message import RestartRequiredMessage
from openapi_client.models.scheduled_task_ended_message import ScheduledTaskEndedMessage
from openapi_client.models.scheduled_tasks_info_message import ScheduledTasksInfoMessage
from openapi_client.models.series_timer_cancelled_message import SeriesTimerCancelledMessage
from openapi_client.models.series_timer_created_message import SeriesTimerCreatedMessage
from openapi_client.models.server_restarting_message import ServerRestartingMessage
from openapi_client.models.server_shutting_down_message import ServerShuttingDownMessage
from openapi_client.models.sessions_message import SessionsMessage
from openapi_client.models.sync_play_command_message import SyncPlayCommandMessage
from openapi_client.models.sync_play_group_update_message import SyncPlayGroupUpdateMessage
from openapi_client.models.timer_cancelled_message import TimerCancelledMessage
from openapi_client.models.timer_created_message import TimerCreatedMessage
from openapi_client.models.user_data_changed_message import UserDataChangedMessage
from openapi_client.models.user_deleted_message import UserDeletedMessage
from openapi_client.models.user_updated_message import UserUpdatedMessage
from pydantic import StrictStr, Field
from typing import Union, List, Set, Optional, Dict
from typing_extensions import Literal, Self

OUTBOUNDWEBSOCKETMESSAGE_ONE_OF_SCHEMAS = ["ActivityLogEntryMessage", "ForceKeepAliveMessage", "GeneralCommandMessage", "LibraryChangedMessage", "OutboundKeepAliveMessage", "PlayMessage", "PlaystateMessage", "PluginInstallationCancelledMessage", "PluginInstallationCompletedMessage", "PluginInstallationFailedMessage", "PluginInstallingMessage", "PluginUninstalledMessage", "RefreshProgressMessage", "RestartRequiredMessage", "ScheduledTaskEndedMessage", "ScheduledTasksInfoMessage", "SeriesTimerCancelledMessage", "SeriesTimerCreatedMessage", "ServerRestartingMessage", "ServerShuttingDownMessage", "SessionsMessage", "SyncPlayCommandMessage", "SyncPlayGroupUpdateMessage", "TimerCancelledMessage", "TimerCreatedMessage", "UserDataChangedMessage", "UserDeletedMessage", "UserUpdatedMessage"]

class OutboundWebSocketMessage(BaseModel):
    """
    Represents the list of possible outbound websocket types
    """
    # data type: ActivityLogEntryMessage
    oneof_schema_1_validator: Optional[ActivityLogEntryMessage] = None
    # data type: ForceKeepAliveMessage
    oneof_schema_2_validator: Optional[ForceKeepAliveMessage] = None
    # data type: GeneralCommandMessage
    oneof_schema_3_validator: Optional[GeneralCommandMessage] = None
    # data type: LibraryChangedMessage
    oneof_schema_4_validator: Optional[LibraryChangedMessage] = None
    # data type: OutboundKeepAliveMessage
    oneof_schema_5_validator: Optional[OutboundKeepAliveMessage] = None
    # data type: PlayMessage
    oneof_schema_6_validator: Optional[PlayMessage] = None
    # data type: PlaystateMessage
    oneof_schema_7_validator: Optional[PlaystateMessage] = None
    # data type: PluginInstallationCancelledMessage
    oneof_schema_8_validator: Optional[PluginInstallationCancelledMessage] = None
    # data type: PluginInstallationCompletedMessage
    oneof_schema_9_validator: Optional[PluginInstallationCompletedMessage] = None
    # data type: PluginInstallationFailedMessage
    oneof_schema_10_validator: Optional[PluginInstallationFailedMessage] = None
    # data type: PluginInstallingMessage
    oneof_schema_11_validator: Optional[PluginInstallingMessage] = None
    # data type: PluginUninstalledMessage
    oneof_schema_12_validator: Optional[PluginUninstalledMessage] = None
    # data type: RefreshProgressMessage
    oneof_schema_13_validator: Optional[RefreshProgressMessage] = None
    # data type: RestartRequiredMessage
    oneof_schema_14_validator: Optional[RestartRequiredMessage] = None
    # data type: ScheduledTaskEndedMessage
    oneof_schema_15_validator: Optional[ScheduledTaskEndedMessage] = None
    # data type: ScheduledTasksInfoMessage
    oneof_schema_16_validator: Optional[ScheduledTasksInfoMessage] = None
    # data type: SeriesTimerCancelledMessage
    oneof_schema_17_validator: Optional[SeriesTimerCancelledMessage] = None
    # data type: SeriesTimerCreatedMessage
    oneof_schema_18_validator: Optional[SeriesTimerCreatedMessage] = None
    # data type: ServerRestartingMessage
    oneof_schema_19_validator: Optional[ServerRestartingMessage] = None
    # data type: ServerShuttingDownMessage
    oneof_schema_20_validator: Optional[ServerShuttingDownMessage] = None
    # data type: SessionsMessage
    oneof_schema_21_validator: Optional[SessionsMessage] = None
    # data type: SyncPlayCommandMessage
    oneof_schema_22_validator: Optional[SyncPlayCommandMessage] = None
    # data type: TimerCancelledMessage
    oneof_schema_23_validator: Optional[TimerCancelledMessage] = None
    # data type: TimerCreatedMessage
    oneof_schema_24_validator: Optional[TimerCreatedMessage] = None
    # data type: UserDataChangedMessage
    oneof_schema_25_validator: Optional[UserDataChangedMessage] = None
    # data type: UserDeletedMessage
    oneof_schema_26_validator: Optional[UserDeletedMessage] = None
    # data type: UserUpdatedMessage
    oneof_schema_27_validator: Optional[UserUpdatedMessage] = None
    # data type: SyncPlayGroupUpdateMessage
    oneof_schema_28_validator: Optional[SyncPlayGroupUpdateMessage] = None
    actual_instance: Optional[Union[ActivityLogEntryMessage, ForceKeepAliveMessage, GeneralCommandMessage, LibraryChangedMessage, OutboundKeepAliveMessage, PlayMessage, PlaystateMessage, PluginInstallationCancelledMessage, PluginInstallationCompletedMessage, PluginInstallationFailedMessage, PluginInstallingMessage, PluginUninstalledMessage, RefreshProgressMessage, RestartRequiredMessage, ScheduledTaskEndedMessage, ScheduledTasksInfoMessage, SeriesTimerCancelledMessage, SeriesTimerCreatedMessage, ServerRestartingMessage, ServerShuttingDownMessage, SessionsMessage, SyncPlayCommandMessage, SyncPlayGroupUpdateMessage, TimerCancelledMessage, TimerCreatedMessage, UserDataChangedMessage, UserDeletedMessage, UserUpdatedMessage]] = None
    one_of_schemas: Set[str] = { "ActivityLogEntryMessage", "ForceKeepAliveMessage", "GeneralCommandMessage", "LibraryChangedMessage", "OutboundKeepAliveMessage", "PlayMessage", "PlaystateMessage", "PluginInstallationCancelledMessage", "PluginInstallationCompletedMessage", "PluginInstallationFailedMessage", "PluginInstallingMessage", "PluginUninstalledMessage", "RefreshProgressMessage", "RestartRequiredMessage", "ScheduledTaskEndedMessage", "ScheduledTasksInfoMessage", "SeriesTimerCancelledMessage", "SeriesTimerCreatedMessage", "ServerRestartingMessage", "ServerShuttingDownMessage", "SessionsMessage", "SyncPlayCommandMessage", "SyncPlayGroupUpdateMessage", "TimerCancelledMessage", "TimerCreatedMessage", "UserDataChangedMessage", "UserDeletedMessage", "UserUpdatedMessage" }

    model_config = ConfigDict(
        validate_assignment=True,
        protected_namespaces=(),
    )


    discriminator_value_class_map: Dict[str, str] = {
    }

    def __init__(self, *args, **kwargs) -> None:
        if args:
            if len(args) > 1:
                raise ValueError("If a position argument is used, only 1 is allowed to set `actual_instance`")
            if kwargs:
                raise ValueError("If a position argument is used, keyword arguments cannot be used.")
            super().__init__(actual_instance=args[0])
        else:
            super().__init__(**kwargs)

    @field_validator('actual_instance')
    def actual_instance_must_validate_oneof(cls, v):
        instance = OutboundWebSocketMessage.model_construct()
        error_messages = []
        match = 0
        # validate data type: ActivityLogEntryMessage
        if not isinstance(v, ActivityLogEntryMessage):
            error_messages.append(f"Error! Input type `{type(v)}` is not `ActivityLogEntryMessage`")
        else:
            match += 1
        # validate data type: ForceKeepAliveMessage
        if not isinstance(v, ForceKeepAliveMessage):
            error_messages.append(f"Error! Input type `{type(v)}` is not `ForceKeepAliveMessage`")
        else:
            match += 1
        # validate data type: GeneralCommandMessage
        if not isinstance(v, GeneralCommandMessage):
            error_messages.append(f"Error! Input type `{type(v)}` is not `GeneralCommandMessage`")
        else:
            match += 1
        # validate data type: LibraryChangedMessage
        if not isinstance(v, LibraryChangedMessage):
            error_messages.append(f"Error! Input type `{type(v)}` is not `LibraryChangedMessage`")
        else:
            match += 1
        # validate data type: OutboundKeepAliveMessage
        if not isinstance(v, OutboundKeepAliveMessage):
            error_messages.append(f"Error! Input type `{type(v)}` is not `OutboundKeepAliveMessage`")
        else:
            match += 1
        # validate data type: PlayMessage
        if not isinstance(v, PlayMessage):
            error_messages.append(f"Error! Input type `{type(v)}` is not `PlayMessage`")
        else:
            match += 1
        # validate data type: PlaystateMessage
        if not isinstance(v, PlaystateMessage):
            error_messages.append(f"Error! Input type `{type(v)}` is not `PlaystateMessage`")
        else:
            match += 1
        # validate data type: PluginInstallationCancelledMessage
        if not isinstance(v, PluginInstallationCancelledMessage):
            error_messages.append(f"Error! Input type `{type(v)}` is not `PluginInstallationCancelledMessage`")
        else:
            match += 1
        # validate data type: PluginInstallationCompletedMessage
        if not isinstance(v, PluginInstallationCompletedMessage):
            error_messages.append(f"Error! Input type `{type(v)}` is not `PluginInstallationCompletedMessage`")
        else:
            match += 1
        # validate data type: PluginInstallationFailedMessage
        if not isinstance(v, PluginInstallationFailedMessage):
            error_messages.append(f"Error! Input type `{type(v)}` is not `PluginInstallationFailedMessage`")
        else:
            match += 1
        # validate data type: PluginInstallingMessage
        if not isinstance(v, PluginInstallingMessage):
            error_messages.append(f"Error! Input type `{type(v)}` is not `PluginInstallingMessage`")
        else:
            match += 1
        # validate data type: PluginUninstalledMessage
        if not isinstance(v, PluginUninstalledMessage):
            error_messages.append(f"Error! Input type `{type(v)}` is not `PluginUninstalledMessage`")
        else:
            match += 1
        # validate data type: RefreshProgressMessage
        if not isinstance(v, RefreshProgressMessage):
            error_messages.append(f"Error! Input type `{type(v)}` is not `RefreshProgressMessage`")
        else:
            match += 1
        # validate data type: RestartRequiredMessage
        if not isinstance(v, RestartRequiredMessage):
            error_messages.append(f"Error! Input type `{type(v)}` is not `RestartRequiredMessage`")
        else:
            match += 1
        # validate data type: ScheduledTaskEndedMessage
        if not isinstance(v, ScheduledTaskEndedMessage):
            error_messages.append(f"Error! Input type `{type(v)}` is not `ScheduledTaskEndedMessage`")
        else:
            match += 1
        # validate data type: ScheduledTasksInfoMessage
        if not isinstance(v, ScheduledTasksInfoMessage):
            error_messages.append(f"Error! Input type `{type(v)}` is not `ScheduledTasksInfoMessage`")
        else:
            match += 1
        # validate data type: SeriesTimerCancelledMessage
        if not isinstance(v, SeriesTimerCancelledMessage):
            error_messages.append(f"Error! Input type `{type(v)}` is not `SeriesTimerCancelledMessage`")
        else:
            match += 1
        # validate data type: SeriesTimerCreatedMessage
        if not isinstance(v, SeriesTimerCreatedMessage):
            error_messages.append(f"Error! Input type `{type(v)}` is not `SeriesTimerCreatedMessage`")
        else:
            match += 1
        # validate data type: ServerRestartingMessage
        if not isinstance(v, ServerRestartingMessage):
            error_messages.append(f"Error! Input type `{type(v)}` is not `ServerRestartingMessage`")
        else:
            match += 1
        # validate data type: ServerShuttingDownMessage
        if not isinstance(v, ServerShuttingDownMessage):
            error_messages.append(f"Error! Input type `{type(v)}` is not `ServerShuttingDownMessage`")
        else:
            match += 1
        # validate data type: SessionsMessage
        if not isinstance(v, SessionsMessage):
            error_messages.append(f"Error! Input type `{type(v)}` is not `SessionsMessage`")
        else:
            match += 1
        # validate data type: SyncPlayCommandMessage
        if not isinstance(v, SyncPlayCommandMessage):
            error_messages.append(f"Error! Input type `{type(v)}` is not `SyncPlayCommandMessage`")
        else:
            match += 1
        # validate data type: TimerCancelledMessage
        if not isinstance(v, TimerCancelledMessage):
            error_messages.append(f"Error! Input type `{type(v)}` is not `TimerCancelledMessage`")
        else:
            match += 1
        # validate data type: TimerCreatedMessage
        if not isinstance(v, TimerCreatedMessage):
            error_messages.append(f"Error! Input type `{type(v)}` is not `TimerCreatedMessage`")
        else:
            match += 1
        # validate data type: UserDataChangedMessage
        if not isinstance(v, UserDataChangedMessage):
            error_messages.append(f"Error! Input type `{type(v)}` is not `UserDataChangedMessage`")
        else:
            match += 1
        # validate data type: UserDeletedMessage
        if not isinstance(v, UserDeletedMessage):
            error_messages.append(f"Error! Input type `{type(v)}` is not `UserDeletedMessage`")
        else:
            match += 1
        # validate data type: UserUpdatedMessage
        if not isinstance(v, UserUpdatedMessage):
            error_messages.append(f"Error! Input type `{type(v)}` is not `UserUpdatedMessage`")
        else:
            match += 1
        # validate data type: SyncPlayGroupUpdateMessage
        if not isinstance(v, SyncPlayGroupUpdateMessage):
            error_messages.append(f"Error! Input type `{type(v)}` is not `SyncPlayGroupUpdateMessage`")
        else:
            match += 1
        if match > 1:
            # more than 1 match
            raise ValueError("Multiple matches found when setting `actual_instance` in OutboundWebSocketMessage with oneOf schemas: ActivityLogEntryMessage, ForceKeepAliveMessage, GeneralCommandMessage, LibraryChangedMessage, OutboundKeepAliveMessage, PlayMessage, PlaystateMessage, PluginInstallationCancelledMessage, PluginInstallationCompletedMessage, PluginInstallationFailedMessage, PluginInstallingMessage, PluginUninstalledMessage, RefreshProgressMessage, RestartRequiredMessage, ScheduledTaskEndedMessage, ScheduledTasksInfoMessage, SeriesTimerCancelledMessage, SeriesTimerCreatedMessage, ServerRestartingMessage, ServerShuttingDownMessage, SessionsMessage, SyncPlayCommandMessage, SyncPlayGroupUpdateMessage, TimerCancelledMessage, TimerCreatedMessage, UserDataChangedMessage, UserDeletedMessage, UserUpdatedMessage. Details: " + ", ".join(error_messages))
        elif match == 0:
            # no match
            raise ValueError("No match found when setting `actual_instance` in OutboundWebSocketMessage with oneOf schemas: ActivityLogEntryMessage, ForceKeepAliveMessage, GeneralCommandMessage, LibraryChangedMessage, OutboundKeepAliveMessage, PlayMessage, PlaystateMessage, PluginInstallationCancelledMessage, PluginInstallationCompletedMessage, PluginInstallationFailedMessage, PluginInstallingMessage, PluginUninstalledMessage, RefreshProgressMessage, RestartRequiredMessage, ScheduledTaskEndedMessage, ScheduledTasksInfoMessage, SeriesTimerCancelledMessage, SeriesTimerCreatedMessage, ServerRestartingMessage, ServerShuttingDownMessage, SessionsMessage, SyncPlayCommandMessage, SyncPlayGroupUpdateMessage, TimerCancelledMessage, TimerCreatedMessage, UserDataChangedMessage, UserDeletedMessage, UserUpdatedMessage. Details: " + ", ".join(error_messages))
        else:
            return v

    @classmethod
    def from_dict(cls, obj: Union[str, Dict[str, Any]]) -> Self:
        return cls.from_json(json.dumps(obj))

    @classmethod
    def from_json(cls, json_str: str) -> Self:
        """Returns the object represented by the json string"""
        instance = cls.model_construct()
        error_messages = []
        match = 0

        # deserialize data into ActivityLogEntryMessage
        try:
            instance.actual_instance = ActivityLogEntryMessage.from_json(json_str)
            match += 1
        except (ValidationError, ValueError) as e:
            error_messages.append(str(e))
        # deserialize data into ForceKeepAliveMessage
        try:
            instance.actual_instance = ForceKeepAliveMessage.from_json(json_str)
            match += 1
        except (ValidationError, ValueError) as e:
            error_messages.append(str(e))
        # deserialize data into GeneralCommandMessage
        try:
            instance.actual_instance = GeneralCommandMessage.from_json(json_str)
            match += 1
        except (ValidationError, ValueError) as e:
            error_messages.append(str(e))
        # deserialize data into LibraryChangedMessage
        try:
            instance.actual_instance = LibraryChangedMessage.from_json(json_str)
            match += 1
        except (ValidationError, ValueError) as e:
            error_messages.append(str(e))
        # deserialize data into OutboundKeepAliveMessage
        try:
            instance.actual_instance = OutboundKeepAliveMessage.from_json(json_str)
            match += 1
        except (ValidationError, ValueError) as e:
            error_messages.append(str(e))
        # deserialize data into PlayMessage
        try:
            instance.actual_instance = PlayMessage.from_json(json_str)
            match += 1
        except (ValidationError, ValueError) as e:
            error_messages.append(str(e))
        # deserialize data into PlaystateMessage
        try:
            instance.actual_instance = PlaystateMessage.from_json(json_str)
            match += 1
        except (ValidationError, ValueError) as e:
            error_messages.append(str(e))
        # deserialize data into PluginInstallationCancelledMessage
        try:
            instance.actual_instance = PluginInstallationCancelledMessage.from_json(json_str)
            match += 1
        except (ValidationError, ValueError) as e:
            error_messages.append(str(e))
        # deserialize data into PluginInstallationCompletedMessage
        try:
            instance.actual_instance = PluginInstallationCompletedMessage.from_json(json_str)
            match += 1
        except (ValidationError, ValueError) as e:
            error_messages.append(str(e))
        # deserialize data into PluginInstallationFailedMessage
        try:
            instance.actual_instance = PluginInstallationFailedMessage.from_json(json_str)
            match += 1
        except (ValidationError, ValueError) as e:
            error_messages.append(str(e))
        # deserialize data into PluginInstallingMessage
        try:
            instance.actual_instance = PluginInstallingMessage.from_json(json_str)
            match += 1
        except (ValidationError, ValueError) as e:
            error_messages.append(str(e))
        # deserialize data into PluginUninstalledMessage
        try:
            instance.actual_instance = PluginUninstalledMessage.from_json(json_str)
            match += 1
        except (ValidationError, ValueError) as e:
            error_messages.append(str(e))
        # deserialize data into RefreshProgressMessage
        try:
            instance.actual_instance = RefreshProgressMessage.from_json(json_str)
            match += 1
        except (ValidationError, ValueError) as e:
            error_messages.append(str(e))
        # deserialize data into RestartRequiredMessage
        try:
            instance.actual_instance = RestartRequiredMessage.from_json(json_str)
            match += 1
        except (ValidationError, ValueError) as e:
            error_messages.append(str(e))
        # deserialize data into ScheduledTaskEndedMessage
        try:
            instance.actual_instance = ScheduledTaskEndedMessage.from_json(json_str)
            match += 1
        except (ValidationError, ValueError) as e:
            error_messages.append(str(e))
        # deserialize data into ScheduledTasksInfoMessage
        try:
            instance.actual_instance = ScheduledTasksInfoMessage.from_json(json_str)
            match += 1
        except (ValidationError, ValueError) as e:
            error_messages.append(str(e))
        # deserialize data into SeriesTimerCancelledMessage
        try:
            instance.actual_instance = SeriesTimerCancelledMessage.from_json(json_str)
            match += 1
        except (ValidationError, ValueError) as e:
            error_messages.append(str(e))
        # deserialize data into SeriesTimerCreatedMessage
        try:
            instance.actual_instance = SeriesTimerCreatedMessage.from_json(json_str)
            match += 1
        except (ValidationError, ValueError) as e:
            error_messages.append(str(e))
        # deserialize data into ServerRestartingMessage
        try:
            instance.actual_instance = ServerRestartingMessage.from_json(json_str)
            match += 1
        except (ValidationError, ValueError) as e:
            error_messages.append(str(e))
        # deserialize data into ServerShuttingDownMessage
        try:
            instance.actual_instance = ServerShuttingDownMessage.from_json(json_str)
            match += 1
        except (ValidationError, ValueError) as e:
            error_messages.append(str(e))
        # deserialize data into SessionsMessage
        try:
            instance.actual_instance = SessionsMessage.from_json(json_str)
            match += 1
        except (ValidationError, ValueError) as e:
            error_messages.append(str(e))
        # deserialize data into SyncPlayCommandMessage
        try:
            instance.actual_instance = SyncPlayCommandMessage.from_json(json_str)
            match += 1
        except (ValidationError, ValueError) as e:
            error_messages.append(str(e))
        # deserialize data into TimerCancelledMessage
        try:
            instance.actual_instance = TimerCancelledMessage.from_json(json_str)
            match += 1
        except (ValidationError, ValueError) as e:
            error_messages.append(str(e))
        # deserialize data into TimerCreatedMessage
        try:
            instance.actual_instance = TimerCreatedMessage.from_json(json_str)
            match += 1
        except (ValidationError, ValueError) as e:
            error_messages.append(str(e))
        # deserialize data into UserDataChangedMessage
        try:
            instance.actual_instance = UserDataChangedMessage.from_json(json_str)
            match += 1
        except (ValidationError, ValueError) as e:
            error_messages.append(str(e))
        # deserialize data into UserDeletedMessage
        try:
            instance.actual_instance = UserDeletedMessage.from_json(json_str)
            match += 1
        except (ValidationError, ValueError) as e:
            error_messages.append(str(e))
        # deserialize data into UserUpdatedMessage
        try:
            instance.actual_instance = UserUpdatedMessage.from_json(json_str)
            match += 1
        except (ValidationError, ValueError) as e:
            error_messages.append(str(e))
        # deserialize data into SyncPlayGroupUpdateMessage
        try:
            instance.actual_instance = SyncPlayGroupUpdateMessage.from_json(json_str)
            match += 1
        except (ValidationError, ValueError) as e:
            error_messages.append(str(e))

        if match > 1:
            # more than 1 match
            raise ValueError("Multiple matches found when deserializing the JSON string into OutboundWebSocketMessage with oneOf schemas: ActivityLogEntryMessage, ForceKeepAliveMessage, GeneralCommandMessage, LibraryChangedMessage, OutboundKeepAliveMessage, PlayMessage, PlaystateMessage, PluginInstallationCancelledMessage, PluginInstallationCompletedMessage, PluginInstallationFailedMessage, PluginInstallingMessage, PluginUninstalledMessage, RefreshProgressMessage, RestartRequiredMessage, ScheduledTaskEndedMessage, ScheduledTasksInfoMessage, SeriesTimerCancelledMessage, SeriesTimerCreatedMessage, ServerRestartingMessage, ServerShuttingDownMessage, SessionsMessage, SyncPlayCommandMessage, SyncPlayGroupUpdateMessage, TimerCancelledMessage, TimerCreatedMessage, UserDataChangedMessage, UserDeletedMessage, UserUpdatedMessage. Details: " + ", ".join(error_messages))
        elif match == 0:
            # no match
            raise ValueError("No match found when deserializing the JSON string into OutboundWebSocketMessage with oneOf schemas: ActivityLogEntryMessage, ForceKeepAliveMessage, GeneralCommandMessage, LibraryChangedMessage, OutboundKeepAliveMessage, PlayMessage, PlaystateMessage, PluginInstallationCancelledMessage, PluginInstallationCompletedMessage, PluginInstallationFailedMessage, PluginInstallingMessage, PluginUninstalledMessage, RefreshProgressMessage, RestartRequiredMessage, ScheduledTaskEndedMessage, ScheduledTasksInfoMessage, SeriesTimerCancelledMessage, SeriesTimerCreatedMessage, ServerRestartingMessage, ServerShuttingDownMessage, SessionsMessage, SyncPlayCommandMessage, SyncPlayGroupUpdateMessage, TimerCancelledMessage, TimerCreatedMessage, UserDataChangedMessage, UserDeletedMessage, UserUpdatedMessage. Details: " + ", ".join(error_messages))
        else:
            return instance

    def to_json(self) -> str:
        """Returns the JSON representation of the actual instance"""
        if self.actual_instance is None:
            return "null"

        if hasattr(self.actual_instance, "to_json") and callable(self.actual_instance.to_json):
            return self.actual_instance.to_json()
        else:
            return json.dumps(self.actual_instance)

    def to_dict(self) -> Optional[Union[Dict[str, Any], ActivityLogEntryMessage, ForceKeepAliveMessage, GeneralCommandMessage, LibraryChangedMessage, OutboundKeepAliveMessage, PlayMessage, PlaystateMessage, PluginInstallationCancelledMessage, PluginInstallationCompletedMessage, PluginInstallationFailedMessage, PluginInstallingMessage, PluginUninstalledMessage, RefreshProgressMessage, RestartRequiredMessage, ScheduledTaskEndedMessage, ScheduledTasksInfoMessage, SeriesTimerCancelledMessage, SeriesTimerCreatedMessage, ServerRestartingMessage, ServerShuttingDownMessage, SessionsMessage, SyncPlayCommandMessage, SyncPlayGroupUpdateMessage, TimerCancelledMessage, TimerCreatedMessage, UserDataChangedMessage, UserDeletedMessage, UserUpdatedMessage]]:
        """Returns the dict representation of the actual instance"""
        if self.actual_instance is None:
            return None

        if hasattr(self.actual_instance, "to_dict") and callable(self.actual_instance.to_dict):
            return self.actual_instance.to_dict()
        else:
            # primitive type
            return self.actual_instance

    def to_str(self) -> str:
        """Returns the string representation of the actual instance"""
        return pprint.pformat(self.model_dump())


