/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ import * as z from "zod/v3"; import { safeParse } from "../../lib/schemas.js"; import { ClosedEnum } from "../../types/enums.js"; import { Result as SafeParseResult } from "../../types/fp.js"; import { SDKValidationError } from "../errors/sdkvalidationerror.js"; export const Button = { Left: "left", Right: "right", Wheel: "wheel", Back: "back", Forward: "forward", } as const; export type Button = ClosedEnum; export type ClickAction = { type: "click"; button: Button; x: number; y: number; }; /** @internal */ export const Button$inboundSchema: z.ZodNativeEnum = z .nativeEnum(Button); /** @internal */ export const Button$outboundSchema: z.ZodNativeEnum = Button$inboundSchema; /** @internal */ export const ClickAction$inboundSchema: z.ZodType< ClickAction, z.ZodTypeDef, unknown > = z.object({ type: z.literal("click"), button: Button$inboundSchema, x: z.number().int(), y: z.number().int(), }); /** @internal */ export type ClickAction$Outbound = { type: "click"; button: string; x: number; y: number; }; /** @internal */ export const ClickAction$outboundSchema: z.ZodType< ClickAction$Outbound, z.ZodTypeDef, ClickAction > = z.object({ type: z.literal("click"), button: Button$outboundSchema, x: z.number().int(), y: z.number().int(), }); export function clickActionToJSON(clickAction: ClickAction): string { return JSON.stringify(ClickAction$outboundSchema.parse(clickAction)); } export function clickActionFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => ClickAction$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'ClickAction' from JSON`, ); }