/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ import * as z from "zod/v3"; import { remap as remap$ } from "../../lib/primitives.js"; import { safeParse } from "../../lib/schemas.js"; import { Result as SafeParseResult } from "../../types/fp.js"; import { SDKValidationError } from "../errors/sdkvalidationerror.js"; import { LayoutControlsDto, LayoutControlsDto$inboundSchema, } from "./layoutcontrolsdto.js"; import { ResourceOriginEnum, ResourceOriginEnum$inboundSchema, } from "./resourceoriginenum.js"; import { ResourceTypeEnum, ResourceTypeEnum$inboundSchema, } from "./resourcetypeenum.js"; /** * User who last updated the layout */ export type UpdatedBy = { /** * User ID */ id: string; /** * User first name */ firstName?: string | null | undefined; /** * User last name */ lastName?: string | null | undefined; /** * User external ID */ externalId?: string | null | undefined; }; export type LayoutResponseDto = { /** * Unique internal identifier of the layout */ id: string; /** * Unique identifier for the layout */ layoutId: string; /** * Slug of the layout */ slug: string; /** * Name of the layout */ name: string; /** * Whether the layout is the default layout */ isDefault: boolean; /** * Whether the layout translations are enabled */ isTranslationEnabled: boolean; /** * Last updated timestamp */ updatedAt: string; /** * User who last updated the layout */ updatedBy?: UpdatedBy | null | undefined; /** * Creation timestamp */ createdAt: string; /** * Origin of the layout */ origin: ResourceOriginEnum; /** * Type of the layout */ type: ResourceTypeEnum; /** * The variables JSON Schema for the layout */ variables?: { [k: string]: any } | null | undefined; /** * Controls metadata for the layout */ controls: LayoutControlsDto; }; /** @internal */ export const UpdatedBy$inboundSchema: z.ZodType< UpdatedBy, z.ZodTypeDef, unknown > = z.object({ _id: z.string(), firstName: z.nullable(z.string()).optional(), lastName: z.nullable(z.string()).optional(), externalId: z.nullable(z.string()).optional(), }).transform((v) => { return remap$(v, { "_id": "id", }); }); export function updatedByFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => UpdatedBy$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'UpdatedBy' from JSON`, ); } /** @internal */ export const LayoutResponseDto$inboundSchema: z.ZodType< LayoutResponseDto, z.ZodTypeDef, unknown > = z.object({ _id: z.string(), layoutId: z.string(), slug: z.string(), name: z.string(), isDefault: z.boolean(), isTranslationEnabled: z.boolean(), updatedAt: z.string(), updatedBy: z.nullable(z.lazy(() => UpdatedBy$inboundSchema)).optional(), createdAt: z.string(), origin: ResourceOriginEnum$inboundSchema, type: ResourceTypeEnum$inboundSchema, variables: z.nullable(z.record(z.any())).optional(), controls: LayoutControlsDto$inboundSchema, }).transform((v) => { return remap$(v, { "_id": "id", }); }); export function layoutResponseDtoFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => LayoutResponseDto$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'LayoutResponseDto' from JSON`, ); }