/* * 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"; import { FulfillmentMethod, FulfillmentMethod$inboundSchema, FulfillmentMethod$outboundSchema, } from "./fulfillmentmethod.js"; import { FulfillmentTimeframe, FulfillmentTimeframe$inboundSchema, FulfillmentTimeframe$outboundSchema, } from "./fulfillmenttimeframe.js"; export type Fulfillment = { method?: FulfillmentMethod | undefined; timeframe?: FulfillmentTimeframe | undefined; }; /** @internal */ export const Fulfillment$inboundSchema: z.ZodType< Fulfillment, z.ZodTypeDef, unknown > = z.object({ method: FulfillmentMethod$inboundSchema.optional(), timeframe: FulfillmentTimeframe$inboundSchema.optional(), }); /** @internal */ export type Fulfillment$Outbound = { method?: string | undefined; timeframe?: string | undefined; }; /** @internal */ export const Fulfillment$outboundSchema: z.ZodType< Fulfillment$Outbound, z.ZodTypeDef, Fulfillment > = z.object({ method: FulfillmentMethod$outboundSchema.optional(), timeframe: FulfillmentTimeframe$outboundSchema.optional(), }); export function fulfillmentToJSON(fulfillment: Fulfillment): string { return JSON.stringify(Fulfillment$outboundSchema.parse(fulfillment)); } export function fulfillmentFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => Fulfillment$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'Fulfillment' from JSON`, ); }