/* * 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 MoveAction = { type: "move"; x: number; y: number; }; /** @internal */ export const MoveAction$inboundSchema: z.ZodType< MoveAction, z.ZodTypeDef, unknown > = z.object({ type: z.literal("move"), x: z.number().int(), y: z.number().int(), }); /** @internal */ export type MoveAction$Outbound = { type: "move"; x: number; y: number; }; /** @internal */ export const MoveAction$outboundSchema: z.ZodType< MoveAction$Outbound, z.ZodTypeDef, MoveAction > = z.object({ type: z.literal("move"), x: z.number().int(), y: z.number().int(), }); export function moveActionToJSON(moveAction: MoveAction): string { return JSON.stringify(MoveAction$outboundSchema.parse(moveAction)); } export function moveActionFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => MoveAction$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'MoveAction' from JSON`, ); }