import { z } from "zod"; export const layerSchema = z.object({ id: z.string(), type: z.enum(["text", "image", "video", "shape"]), x: z.number(), y: z.number(), width: z.number(), height: z.number(), rotation: z.number(), opacity: z.number(), zIndex: z.number(), props: z.record(z.string(), z.unknown()), }); export const sceneSchema = z.object({ id: z.string(), name: z.string(), duration: z.number().positive(), layers: z.array(layerSchema), thumbnailUrl: z.string().optional(), }); export const renderSettingsSchema = z.object({ resolution: z.enum(["720p", "1080p", "4K"]), format: z.literal("mp4").default("mp4"), fps: z.union([z.literal(24), z.literal(30), z.literal(60)]), }); export const renderRequestSchema = z.object({ projectId: z.string().min(1), // scenes is no longer sent to the server — V2 render service fetches the // project directly from the Studio service via saved_project_id. scenes: z.array(sceneSchema).optional(), settings: renderSettingsSchema, }); export type RenderRequest = z.infer; export type RenderSettings = z.infer; export type RenderScene = z.infer; export const renderStatusSchema = z.enum([ "queued", "processing", "completed", "failed", ]); export type RenderJobStatus = z.infer; export const RESOLUTION_DIMENSIONS: Record< RenderSettings["resolution"], { width: number; height: number } > = { "720p": { width: 1280, height: 720 }, "1080p": { width: 1920, height: 1080 }, "4K": { width: 3840, height: 2160 }, };