import { BaseModel } from '@verb/src/libs/shared/base/base.model'; export interface StreamAttendeeMessagingSchema { attendee_id: string; connection_id: string; is_host: boolean; stream_id: number; } export function getStreamAttendeeMessagingKey(connectionId: string) { return `stream-attendee-messaging-schema-${connectionId}`; } export function getConnectionIdFromAttendeeIdKey(attendeeId: string) { return `stream-attendee-messaging-schema-${attendeeId}`; } export class StreamAttendeeMessagingModel implements BaseModel { public get attendeeId() { return this._attendeeId; } public get connectionId() { return this._connectionId; } public get isHost() { return this._isHost; } public set isHost(isHost: boolean) { this._isHost = isHost; } public get streamId() { return this._streamId; } public constructor(streamAttendeeMessagingSchema?: StreamAttendeeMessagingSchema) { if (streamAttendeeMessagingSchema) { this.fromSchema(streamAttendeeMessagingSchema); } } public fromSchema(streamAttendeeMessagingSchema: StreamAttendeeMessagingSchema) { this._attendeeId = streamAttendeeMessagingSchema.attendee_id; this._connectionId = streamAttendeeMessagingSchema.connection_id; this._isHost = streamAttendeeMessagingSchema.is_host; this._streamId = streamAttendeeMessagingSchema.stream_id; } public toSchema(): StreamAttendeeMessagingSchema { return { attendee_id: this._attendeeId, connection_id: this._connectionId, is_host: this._isHost, stream_id: this._streamId, }; } private _attendeeId!: string; private _connectionId!: string; private _isHost!: boolean; private _streamId!: number; }