import { SchemaModel } from '@verb/src/libs/shared/base/base.model'; import { StreamAttendeeOptionsModel, StreamAttendeeOptionsSchema, streamAttendeeOptionsValidationSchema, } from './stream-attendee-options.model'; import { StreamHostOptionsModel, StreamHostOptionsSchema, streamHostOptionsValidationSchema, } from './stream-host-options.model'; import { SubSchema } from '@verb/src/libs/shared/json-schema-validator/schema-types'; export class StreamOptionsModel implements SchemaModel { public attendee = new StreamAttendeeOptionsModel(); public host = new StreamHostOptionsModel(); public constructor(streamOptionsSchema?: StreamOptionsSchema) { if (streamOptionsSchema) { this.fromSchema(streamOptionsSchema); } } public fromSchema(streamOptionsSchema: StreamOptionsSchema) { this.attendee = new StreamAttendeeOptionsModel(streamOptionsSchema.attendee); this.host = new StreamHostOptionsModel(streamOptionsSchema.host); } public toSchema(): StreamOptionsSchema { return { attendee: this.attendee.toSchema(), host: this.host.toSchema(), }; } } export interface StreamOptionsSchema { attendee: StreamAttendeeOptionsSchema; host: StreamHostOptionsSchema; } export const streamOptionsValidationSchema: SubSchema = { additionalProperties: false, description: 'Stream Options object', properties: { attendee: streamAttendeeOptionsValidationSchema, host: streamHostOptionsValidationSchema, }, required: ['attendee', 'host'], type: 'object', };