import { type ZodString, type ZodType } from 'zod'; import type { MediaId } from './media.ts'; import type { Peer, PeerId } from './peer.ts'; import type { JsonValue } from '../serialization.ts'; export type RoomId = string; export declare const RoomIdSchema: ZodString; export declare namespace RoomV1 { type Room = { id: RoomId; customer: string; user_data: Uint8Array; peers: Peer[]; }; const RoomSchema: ZodType; type RoomUpdate = { kind: 'Joined'; room: Room; media_ids: MediaId[]; own_peer_id: PeerId; } | { kind: 'Left'; reason: 'RoomClosing' | 'ServerClosing' | 'PeerKicked'; } | { kind: 'PeerJoined'; peer: Peer; } | { kind: 'PeerLeft'; peer_id: PeerId; } | { kind: 'UserDataChanged'; user_data?: Uint8Array; }; const RoomUpdateSchema: ZodType; type RoomUpdates = { updates: RoomUpdate[]; }; const RoomUpdatesSchema: ZodType; type RoomStatus = 'Joining' | 'Joined' | 'Closed'; const RoomStatusSchema: ZodType; type RoomStatusChanged = { status: RoomStatus; message?: string; }; const RoomStatusChangedSchema: ZodType; } export declare namespace RoomV2 { type Parameters = Record; const ParametersSchema: ZodType; type ChannelPosition = { x: number; y: number; z: number; channel: number; }; const PositionSchema: ZodType; type ChannelMask = bigint; const ChannelMaskSchema: ZodType; type HelloRoom = { token: string; room_id?: RoomId; user_data?: Uint8Array; parameters?: Parameters; channel_masks?: Array<[number, ChannelMask]>; positions?: ChannelPosition[]; }; const HelloRoomSchema: ZodType; type ClientHello = { Room: HelloRoom; }; const ClientHelloSchema: ZodType; type ServerHello = { Ok: Record; } | { Rejected: { message: string; }; }; const ServerHelloSchema: ZodType; type PeerProperties = { user_data?: Uint8Array; tags?: string[]; parameters?: Record; }; const PeerPropertiesSchema: ZodType; type Ping = { Ping: { id: number; }; }; const PingSchema: ZodType; type ChangeSelf = { ChangeSelf: Omit; }; const ChangeSelfSchema: ZodType; type SetAudioMask = { SetAudioMask: { peer_id: number; mask: bigint; }; }; const SetAudioMaskSchema: ZodType; type SendMessage = { SendMessage: { peer_ids: number[]; message: Uint8Array; }; }; const SendMessageSchema: ZodType; type Call = Ping | ChangeSelf | SetAudioMask | SendMessage; const CallSchema: ZodType; type Pong = { Pong: { id: number; }; }; const PongSchema: ZodType; type Joined = { Joined: { own_peer_id: number; room_id: string; customer: string; }; }; const JoinedSchema: ZodType; type Left = { Left: { reason: 'room_closing' | 'server_closing' | 'peer_kicked'; }; }; const LeftSchema: ZodType; type PeerJoined = { PeerJoined: PeerProperties & { peer_id: number; user_id: string; }; }; const PeerJoinedSchema: ZodType; type PeerLeft = { PeerLeft: { peer_id: number; }; }; const PeerLeftSchema: ZodType; type PeerChanged = { PeerChanged: PeerProperties & { peer_id: number; }; }; const PeerChangedSchema: ZodType; type NewReconnectToken = { NewReconnectToken: { token: string; }; }; const NewReconnectTokenSchema: ZodType; type MessageReceived = { MessageReceived: { sender_peer_id: number; message: Uint8Array; }; }; const MessageReceivedSchema: ZodType; type ServerError = { Error: { message: string; }; }; const ServerErrorSchema: ZodType; type Event = Pong | Joined | Left | PeerJoined | PeerLeft | PeerChanged | NewReconnectToken | MessageReceived | ServerError; const EventSchema: ZodType; }