/* * 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 { lazySchema as lazySchema$, safeParse } from "../../lib/schemas.js"; import { Result as SafeParseResult } from "../../types/fp.js"; import * as types from "../../types/primitives.js"; import { smartUnion } from "../../types/smartUnion.js"; import { SDKValidationError } from "../errors/sdkvalidationerror.js"; export type Five = string | number | number; export type Value = | string | number | number | boolean | Array; export type SimpleFormFieldOption = { label: string; value?: | string | number | number | boolean | Array | undefined; optionType: "simple"; }; /** @internal */ export const Five$inboundSchema: z.ZodType = /* @__PURE__ */ lazySchema$(() => smartUnion([types.string(), types.number(), types.number()]) ); /** @internal */ export type Five$Outbound = string | number | number; /** @internal */ export const Five$outboundSchema: z.ZodType = /* @__PURE__ */ lazySchema$(() => smartUnion([z.string(), z.number().int(), z.number()]) ); export function fiveToJSON(five: Five): string { return JSON.stringify(Five$outboundSchema.parse(five)); } export function fiveFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => Five$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'Five' from JSON`, ); } /** @internal */ export const Value$inboundSchema: z.ZodType = /* @__PURE__ */ lazySchema$(() => smartUnion([ types.string(), types.number(), types.number(), types.boolean(), z.array(smartUnion([types.string(), types.number(), types.number()])), ]) ); /** @internal */ export type Value$Outbound = | string | number | number | boolean | Array; /** @internal */ export const Value$outboundSchema: z.ZodType< Value$Outbound, z.ZodTypeDef, Value > = /* @__PURE__ */ lazySchema$(() => smartUnion([ z.string(), z.number().int(), z.number(), z.boolean(), z.array(smartUnion([z.string(), z.number().int(), z.number()])), ]) ); export function valueToJSON(value: Value): string { return JSON.stringify(Value$outboundSchema.parse(value)); } export function valueFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => Value$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'Value' from JSON`, ); } /** @internal */ export const SimpleFormFieldOption$inboundSchema: z.ZodType< SimpleFormFieldOption, z.ZodTypeDef, unknown > = /* @__PURE__ */ lazySchema$(() => z.object({ label: types.string(), value: types.optional( smartUnion([ types.string(), types.number(), types.number(), types.boolean(), z.array(smartUnion([types.string(), types.number(), types.number()])), ]), ), option_type: types.literal("simple"), }).transform((v) => { return remap$(v, { "option_type": "optionType", }); }) ); /** @internal */ export type SimpleFormFieldOption$Outbound = { label: string; value?: | string | number | number | boolean | Array | undefined; option_type: "simple"; }; /** @internal */ export const SimpleFormFieldOption$outboundSchema: z.ZodType< SimpleFormFieldOption$Outbound, z.ZodTypeDef, SimpleFormFieldOption > = /* @__PURE__ */ lazySchema$(() => z.object({ label: z.string(), value: smartUnion([ z.string(), z.number().int(), z.number(), z.boolean(), z.array(smartUnion([z.string(), z.number().int(), z.number()])), ]).optional(), optionType: z.literal("simple"), }).transform((v) => { return remap$(v, { optionType: "option_type", }); }) ); export function simpleFormFieldOptionToJSON( simpleFormFieldOption: SimpleFormFieldOption, ): string { return JSON.stringify( SimpleFormFieldOption$outboundSchema.parse(simpleFormFieldOption), ); } export function simpleFormFieldOptionFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => SimpleFormFieldOption$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'SimpleFormFieldOption' from JSON`, ); }