/* * 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 { AmountDecimal, AmountDecimal$inboundSchema, AmountDecimal$Outbound, AmountDecimal$outboundSchema, } from "./amountdecimal.js"; /** * Represents a modifier or option applied to a line item. */ export type CreateTransferLineItemOption = { /** * The name of the option or modifier. */ name: string; /** * The quantity of this option. */ quantity: number; /** * Optional price modification applied by this option. Can be positive, negative, or zero. */ priceModifier?: AmountDecimal | undefined; /** * Optional list of images associated with this line item option. */ imageIDs?: Array | undefined; /** * Optional group identifier to categorize related options (e.g., 'toppings'). */ group?: string | undefined; }; /** @internal */ export const CreateTransferLineItemOption$inboundSchema: z.ZodType< CreateTransferLineItemOption, z.ZodTypeDef, unknown > = z.object({ name: z.string(), quantity: z.number().int(), priceModifier: AmountDecimal$inboundSchema.optional(), imageIDs: z.array(z.string()).optional(), group: z.string().optional(), }); /** @internal */ export type CreateTransferLineItemOption$Outbound = { name: string; quantity: number; priceModifier?: AmountDecimal$Outbound | undefined; imageIDs?: Array | undefined; group?: string | undefined; }; /** @internal */ export const CreateTransferLineItemOption$outboundSchema: z.ZodType< CreateTransferLineItemOption$Outbound, z.ZodTypeDef, CreateTransferLineItemOption > = z.object({ name: z.string(), quantity: z.number().int(), priceModifier: AmountDecimal$outboundSchema.optional(), imageIDs: z.array(z.string()).optional(), group: z.string().optional(), }); export function createTransferLineItemOptionToJSON( createTransferLineItemOption: CreateTransferLineItemOption, ): string { return JSON.stringify( CreateTransferLineItemOption$outboundSchema.parse( createTransferLineItemOption, ), ); } export function createTransferLineItemOptionFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => CreateTransferLineItemOption$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'CreateTransferLineItemOption' from JSON`, ); }