/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ import * as z from "zod/v3"; import { safeParse } from "../../lib/schemas.js"; import { Result as SafeParseResult } from "../../types/fp.js"; import { SDKValidationError } from "../errors/sdkvalidationerror.js"; export type Path = { x: number; y: number; }; export type DragAction = { type: "drag"; path: Array; }; /** @internal */ export const Path$inboundSchema: z.ZodType = z .object({ x: z.number().int(), y: z.number().int(), }); /** @internal */ export type Path$Outbound = { x: number; y: number; }; /** @internal */ export const Path$outboundSchema: z.ZodType = z.object({ x: z.number().int(), y: z.number().int(), }); export function pathToJSON(path: Path): string { return JSON.stringify(Path$outboundSchema.parse(path)); } export function pathFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => Path$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'Path' from JSON`, ); } /** @internal */ export const DragAction$inboundSchema: z.ZodType< DragAction, z.ZodTypeDef, unknown > = z.object({ type: z.literal("drag"), path: z.array(z.lazy(() => Path$inboundSchema)), }); /** @internal */ export type DragAction$Outbound = { type: "drag"; path: Array; }; /** @internal */ export const DragAction$outboundSchema: z.ZodType< DragAction$Outbound, z.ZodTypeDef, DragAction > = z.object({ type: z.literal("drag"), path: z.array(z.lazy(() => Path$outboundSchema)), }); export function dragActionToJSON(dragAction: DragAction): string { return JSON.stringify(DragAction$outboundSchema.parse(dragAction)); } export function dragActionFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => DragAction$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'DragAction' from JSON`, ); }