// This file was generated by liblab | https://liblab.com/ import { z } from 'zod'; import { scenePostType } from './scene-post-type'; import { actionPost, actionPostRequest, actionPostResponse } from '../../common/action-post'; import { sceneMetadata, sceneMetadataRequest, sceneMetadataResponse } from '../../common/scene-metadata'; import { resourceIdentifier, resourceIdentifierRequest, resourceIdentifierResponse, } from '../../common/resource-identifier'; import { scenePalette, scenePaletteRequest, scenePaletteResponse } from '../../common/scene-palette'; /** * The shape of the model inside the application code - what the users use */ export const scenePost = z.object({ type_: scenePostType.optional(), actions: z.array(actionPost), metadata: sceneMetadata, group: resourceIdentifier, palette: scenePalette.optional(), speed: z.number().gte(0).lte(1).optional(), autoDynamic: z.boolean().optional(), }); /** * * @typedef {ScenePost} scenePost * @property {ScenePostType} * @property {ActionPost[]} - List of actions to be executed synchronously on recall * @property {SceneMetadata} * @property {ResourceIdentifier} * @property {ScenePalette} - Group of colors that describe the palette of colors to be used when playing dynamics * @property {number} - Speed of dynamic palette for this scene * @property {boolean} - Indicates whether to automatically start the scene dynamically on active recall */ export type ScenePost = z.infer; /** * The shape of the model mapping from the api schema into the application shape. * Is equal to application shape if all property names match the api schema */ export const scenePostResponse = z .object({ type: scenePostType.optional(), actions: z.array(actionPostResponse), metadata: sceneMetadataResponse, group: resourceIdentifierResponse, palette: scenePaletteResponse.optional(), speed: z.number().gte(0).lte(1).optional(), auto_dynamic: z.boolean().optional(), }) .transform((data) => ({ type_: data['type'], actions: data['actions'], metadata: data['metadata'], group: data['group'], palette: data['palette'], speed: data['speed'], autoDynamic: data['auto_dynamic'], })); /** * The shape of the model mapping from the application shape into the api schema. * Is equal to application shape if all property names match the api schema */ export const scenePostRequest = z .object({ type_: scenePostType.nullish(), actions: z.array(actionPostRequest).nullish(), metadata: sceneMetadataRequest.nullish(), group: resourceIdentifierRequest.nullish(), palette: scenePaletteRequest.nullish(), speed: z.number().nullish(), autoDynamic: z.boolean().nullish(), }) .transform((data) => ({ type: data['type_'], actions: data['actions'], metadata: data['metadata'], group: data['group'], palette: data['palette'], speed: data['speed'], auto_dynamic: data['autoDynamic'], }));