import { defineMigrations } from '@bigbluebutton/store' import { T } from '@bigbluebutton/validate' import { assetIdValidator } from '../assets/TLBaseAsset' import { ShapePropsType, TLBaseShape } from './TLBaseShape' /** @public */ export const videoShapeProps = { w: T.nonZeroNumber, h: T.nonZeroNumber, time: T.number, playing: T.boolean, url: T.string, assetId: assetIdValidator.nullable(), } /** @public */ export type TLVideoShapeProps = ShapePropsType /** @public */ export type TLVideoShape = TLBaseShape<'video', TLVideoShapeProps> const Versions = { AddUrlProp: 1, } as const /** @internal */ export const videoShapeMigrations = defineMigrations({ currentVersion: Versions.AddUrlProp, migrators: { [Versions.AddUrlProp]: { up: (shape) => { return { ...shape, props: { ...shape.props, url: '' } } }, down: (shape) => { const { url: _, ...props } = shape.props return { ...shape, props } }, }, }, })