2022-06-07 08:49:12 +02:00
|
|
|
import { z } from 'zod'
|
2023-11-08 15:34:16 +01:00
|
|
|
import { blockBaseSchema } from '../../shared'
|
|
|
|
import { VideoBubbleContentType } from './constants'
|
2023-10-12 14:48:52 +02:00
|
|
|
import { variableStringSchema } from '../../../utils'
|
2023-11-08 15:34:16 +01:00
|
|
|
import { BubbleBlockType } from '../constants'
|
2022-06-07 08:49:12 +02:00
|
|
|
|
|
|
|
export const videoBubbleContentSchema = z.object({
|
|
|
|
url: z.string().optional(),
|
|
|
|
id: z.string().optional(),
|
|
|
|
type: z.nativeEnum(VideoBubbleContentType).optional(),
|
2023-10-12 14:48:52 +02:00
|
|
|
height: z.number().or(variableStringSchema).optional(),
|
2022-06-07 08:49:12 +02:00
|
|
|
})
|
|
|
|
|
2023-03-14 16:42:12 +01:00
|
|
|
export const videoBubbleBlockSchema = blockBaseSchema.merge(
|
2022-06-07 08:49:12 +02:00
|
|
|
z.object({
|
2022-06-11 07:27:38 +02:00
|
|
|
type: z.enum([BubbleBlockType.VIDEO]),
|
2023-11-08 15:34:16 +01:00
|
|
|
content: videoBubbleContentSchema.optional(),
|
2022-06-07 08:49:12 +02:00
|
|
|
})
|
|
|
|
)
|
|
|
|
|
2022-06-11 07:27:38 +02:00
|
|
|
export type VideoBubbleBlock = z.infer<typeof videoBubbleBlockSchema>
|