# Generated by the protocol buffer compiler.  DO NOT EDIT!
# sources: fishjam/agent_notifications.proto, fishjam/server_notifications.proto
# plugin: python-betterproto
# This file has been @generated

from dataclasses import dataclass

import betterproto

from . import notifications


class ServerMessagePeerType(betterproto.Enum):
    PEER_TYPE_UNSPECIFIED = 0
    PEER_TYPE_WEBRTC = 1
    PEER_TYPE_AGENT = 2


class ServerMessageEventType(betterproto.Enum):
    """Defines message groups for which peer can subscribe"""

    EVENT_TYPE_UNSPECIFIED = 0
    EVENT_TYPE_SERVER_NOTIFICATION = 1


@dataclass(eq=False, repr=False)
class AgentRequest(betterproto.Message):
    """Defines any type of message passed from agent peer to Fishjam"""

    auth_request: "AgentRequestAuthRequest" = betterproto.message_field(
        1, group="content"
    )
    add_track: "AgentRequestAddTrack" = betterproto.message_field(2, group="content")
    remove_track: "AgentRequestRemoveTrack" = betterproto.message_field(
        3, group="content"
    )
    track_data: "AgentRequestTrackData" = betterproto.message_field(4, group="content")


@dataclass(eq=False, repr=False)
class AgentRequestAuthRequest(betterproto.Message):
    """Request sent by agent, to authenticate to Fishjam server"""

    token: str = betterproto.string_field(1)


@dataclass(eq=False, repr=False)
class AgentRequestAddTrack(betterproto.Message):
    """Request to add a track of the specified type"""

    track: "notifications.Track" = betterproto.message_field(1)
    """Specification of the track to be added"""

    codec_params: "AgentRequestAddTrackCodecParameters" = betterproto.message_field(2)
    """Parameters of the input data stream"""


@dataclass(eq=False, repr=False)
class AgentRequestAddTrackCodecParameters(betterproto.Message):
    encoding: "notifications.TrackEncoding" = betterproto.enum_field(1)
    """The format of the input stream, defaults to pcm16"""

    sample_rate: int = betterproto.uint32_field(2)
    """The sample rate of the input stream, may be omitted for opus"""

    channels: int = betterproto.uint32_field(3)
    """The number of channels. 1 means mono, 2 means stereo"""


@dataclass(eq=False, repr=False)
class AgentRequestRemoveTrack(betterproto.Message):
    """Removes the given track"""

    track_id: str = betterproto.string_field(1)


@dataclass(eq=False, repr=False)
class AgentRequestTrackData(betterproto.Message):
    """Notification containing a chunk of an agent's track's data stream"""

    track_id: str = betterproto.string_field(1)
    data: bytes = betterproto.bytes_field(2)


@dataclass(eq=False, repr=False)
class AgentResponse(betterproto.Message):
    """Defines any type of message passed from Fishjam to agent peer"""

    authenticated: "AgentResponseAuthenticated" = betterproto.message_field(
        1, group="content"
    )
    track_data: "AgentResponseTrackData" = betterproto.message_field(2, group="content")


@dataclass(eq=False, repr=False)
class AgentResponseAuthenticated(betterproto.Message):
    """Response confirming successful authentication"""

    pass


@dataclass(eq=False, repr=False)
class AgentResponseTrackData(betterproto.Message):
    """Notification containing a chunk of a track's data stream"""

    peer_id: str = betterproto.string_field(1)
    track: "notifications.Track" = betterproto.message_field(2)
    data: bytes = betterproto.bytes_field(3)


@dataclass(eq=False, repr=False)
class ServerMessage(betterproto.Message):
    """Defines any type of message passed between FJ and server peer"""

    room_crashed: "ServerMessageRoomCrashed" = betterproto.message_field(
        1, group="content"
    )
    peer_connected: "ServerMessagePeerConnected" = betterproto.message_field(
        2, group="content"
    )
    peer_disconnected: "ServerMessagePeerDisconnected" = betterproto.message_field(
        3, group="content"
    )
    peer_crashed: "ServerMessagePeerCrashed" = betterproto.message_field(
        4, group="content"
    )
    component_crashed: "ServerMessageComponentCrashed" = betterproto.message_field(
        5, group="content"
    )
    authenticated: "ServerMessageAuthenticated" = betterproto.message_field(
        6, group="content"
    )
    auth_request: "ServerMessageAuthRequest" = betterproto.message_field(
        7, group="content"
    )
    subscribe_request: "ServerMessageSubscribeRequest" = betterproto.message_field(
        8, group="content"
    )
    subscribe_response: "ServerMessageSubscribeResponse" = betterproto.message_field(
        9, group="content"
    )
    room_created: "ServerMessageRoomCreated" = betterproto.message_field(
        10, group="content"
    )
    room_deleted: "ServerMessageRoomDeleted" = betterproto.message_field(
        11, group="content"
    )
    hls_playable: "ServerMessageHlsPlayable" = betterproto.message_field(
        13, group="content"
    )
    hls_uploaded: "ServerMessageHlsUploaded" = betterproto.message_field(
        14, group="content"
    )
    hls_upload_crashed: "ServerMessageHlsUploadCrashed" = betterproto.message_field(
        15, group="content"
    )
    peer_metadata_updated: "ServerMessagePeerMetadataUpdated" = (
        betterproto.message_field(16, group="content")
    )
    track_added: "ServerMessageTrackAdded" = betterproto.message_field(
        17, group="content"
    )
    track_removed: "ServerMessageTrackRemoved" = betterproto.message_field(
        18, group="content"
    )
    track_metadata_updated: "ServerMessageTrackMetadataUpdated" = (
        betterproto.message_field(19, group="content")
    )
    peer_added: "ServerMessagePeerAdded" = betterproto.message_field(
        20, group="content"
    )
    peer_deleted: "ServerMessagePeerDeleted" = betterproto.message_field(
        21, group="content"
    )
    stream_connected: "ServerMessageStreamConnected" = betterproto.message_field(
        22, group="content"
    )
    stream_disconnected: "ServerMessageStreamDisconnected" = betterproto.message_field(
        23, group="content"
    )
    viewer_connected: "ServerMessageViewerConnected" = betterproto.message_field(
        24, group="content"
    )
    viewer_disconnected: "ServerMessageViewerDisconnected" = betterproto.message_field(
        25, group="content"
    )


@dataclass(eq=False, repr=False)
class ServerMessageRoomCrashed(betterproto.Message):
    """Notification sent when a room crashes"""

    room_id: str = betterproto.string_field(1)


@dataclass(eq=False, repr=False)
class ServerMessagePeerAdded(betterproto.Message):
    """Notification sent when a peer is added"""

    room_id: str = betterproto.string_field(1)
    peer_id: str = betterproto.string_field(2)
    peer_type: "ServerMessagePeerType" = betterproto.enum_field(3)


@dataclass(eq=False, repr=False)
class ServerMessagePeerDeleted(betterproto.Message):
    """Notification sent when a peer is removed"""

    room_id: str = betterproto.string_field(1)
    peer_id: str = betterproto.string_field(2)
    peer_type: "ServerMessagePeerType" = betterproto.enum_field(3)


@dataclass(eq=False, repr=False)
class ServerMessagePeerConnected(betterproto.Message):
    """Notification sent when a peer connects"""

    room_id: str = betterproto.string_field(1)
    peer_id: str = betterproto.string_field(2)
    peer_type: "ServerMessagePeerType" = betterproto.enum_field(3)


@dataclass(eq=False, repr=False)
class ServerMessagePeerDisconnected(betterproto.Message):
    """Notification sent when a peer disconnects from FJ"""

    room_id: str = betterproto.string_field(1)
    peer_id: str = betterproto.string_field(2)
    peer_type: "ServerMessagePeerType" = betterproto.enum_field(3)


@dataclass(eq=False, repr=False)
class ServerMessagePeerCrashed(betterproto.Message):
    """Notification sent when a peer crashes"""

    room_id: str = betterproto.string_field(1)
    peer_id: str = betterproto.string_field(2)
    reason: str = betterproto.string_field(3)
    peer_type: "ServerMessagePeerType" = betterproto.enum_field(4)


@dataclass(eq=False, repr=False)
class ServerMessageComponentCrashed(betterproto.Message):
    """Notification sent when a component crashes"""

    room_id: str = betterproto.string_field(1)
    component_id: str = betterproto.string_field(2)


@dataclass(eq=False, repr=False)
class ServerMessageAuthenticated(betterproto.Message):
    """Response sent by FJ, confirming successfull authentication"""

    pass


@dataclass(eq=False, repr=False)
class ServerMessageAuthRequest(betterproto.Message):
    """Request sent by peer, to authenticate to FJ server"""

    token: str = betterproto.string_field(1)


@dataclass(eq=False, repr=False)
class ServerMessageSubscribeRequest(betterproto.Message):
    """Request sent by peer to subsribe for certain message type"""

    event_type: "ServerMessageEventType" = betterproto.enum_field(1)


@dataclass(eq=False, repr=False)
class ServerMessageSubscribeResponse(betterproto.Message):
    """Response sent by FJ, confirming subscription for message type"""

    event_type: "ServerMessageEventType" = betterproto.enum_field(1)


@dataclass(eq=False, repr=False)
class ServerMessageRoomCreated(betterproto.Message):
    """Notification sent when a room is created"""

    room_id: str = betterproto.string_field(1)


@dataclass(eq=False, repr=False)
class ServerMessageRoomDeleted(betterproto.Message):
    """Notification sent when a room is deleted"""

    room_id: str = betterproto.string_field(1)


@dataclass(eq=False, repr=False)
class ServerMessageHlsPlayable(betterproto.Message):
    """Notification sent when the HLS stream becomes available in a room"""

    room_id: str = betterproto.string_field(1)
    component_id: str = betterproto.string_field(2)


@dataclass(eq=False, repr=False)
class ServerMessageHlsUploaded(betterproto.Message):
    """
    Notification sent when the HLS recording is successfully uploded to AWS S3
    """

    room_id: str = betterproto.string_field(1)


@dataclass(eq=False, repr=False)
class ServerMessageHlsUploadCrashed(betterproto.Message):
    """Notification sent when the upload of HLS recording to AWS S3 fails"""

    room_id: str = betterproto.string_field(1)


@dataclass(eq=False, repr=False)
class ServerMessagePeerMetadataUpdated(betterproto.Message):
    """Notification sent when peer updates its metadata"""

    room_id: str = betterproto.string_field(1)
    peer_id: str = betterproto.string_field(2)
    metadata: str = betterproto.string_field(3)
    peer_type: "ServerMessagePeerType" = betterproto.enum_field(4)


@dataclass(eq=False, repr=False)
class ServerMessageTrackAdded(betterproto.Message):
    """Notification sent when peer or component adds new track"""

    room_id: str = betterproto.string_field(1)
    peer_id: str = betterproto.string_field(2, group="endpoint_info")
    component_id: str = betterproto.string_field(3, group="endpoint_info")
    track: "notifications.Track" = betterproto.message_field(4)


@dataclass(eq=False, repr=False)
class ServerMessageTrackRemoved(betterproto.Message):
    """Notification sent when a track is removed"""

    room_id: str = betterproto.string_field(1)
    peer_id: str = betterproto.string_field(2, group="endpoint_info")
    component_id: str = betterproto.string_field(3, group="endpoint_info")
    track: "notifications.Track" = betterproto.message_field(4)


@dataclass(eq=False, repr=False)
class ServerMessageTrackMetadataUpdated(betterproto.Message):
    """Notification sent when metadata of a multimedia track is updated"""

    room_id: str = betterproto.string_field(1)
    peer_id: str = betterproto.string_field(2, group="endpoint_info")
    component_id: str = betterproto.string_field(3, group="endpoint_info")
    track: "notifications.Track" = betterproto.message_field(4)


@dataclass(eq=False, repr=False)
class ServerMessageStreamConnected(betterproto.Message):
    """Notification sent when streamer successfully connects"""

    stream_id: str = betterproto.string_field(1)


@dataclass(eq=False, repr=False)
class ServerMessageStreamDisconnected(betterproto.Message):
    """Notification sent when streamer disconnects"""

    stream_id: str = betterproto.string_field(1)


@dataclass(eq=False, repr=False)
class ServerMessageViewerConnected(betterproto.Message):
    """Notification sent when viewer successfully connects"""

    stream_id: str = betterproto.string_field(1)
    viewer_id: str = betterproto.string_field(2)


@dataclass(eq=False, repr=False)
class ServerMessageViewerDisconnected(betterproto.Message):
    """Notification sent when viewer disconnects"""

    stream_id: str = betterproto.string_field(1)
    viewer_id: str = betterproto.string_field(2)
