/* * 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"; import { ScheduledTransferImageMetadata, ScheduledTransferImageMetadata$inboundSchema, ScheduledTransferImageMetadata$Outbound, ScheduledTransferImageMetadata$outboundSchema, } from "./scheduledtransferimagemetadata.js"; /** * Represents a modifier or option applied to a scheduled transfer line item. */ export type ScheduledTransferLineItemOption = { /** * 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 group identifier to categorize related options (e.g., 'toppings'). */ group?: string | undefined; /** * Optional list of images associated with this line item. */ images?: Array | undefined; }; /** @internal */ export const ScheduledTransferLineItemOption$inboundSchema: z.ZodType< ScheduledTransferLineItemOption, z.ZodTypeDef, unknown > = z.object({ name: z.string(), quantity: z.number().int(), priceModifier: AmountDecimal$inboundSchema.optional(), group: z.string().optional(), images: z.array(ScheduledTransferImageMetadata$inboundSchema).optional(), }); /** @internal */ export type ScheduledTransferLineItemOption$Outbound = { name: string; quantity: number; priceModifier?: AmountDecimal$Outbound | undefined; group?: string | undefined; images?: Array | undefined; }; /** @internal */ export const ScheduledTransferLineItemOption$outboundSchema: z.ZodType< ScheduledTransferLineItemOption$Outbound, z.ZodTypeDef, ScheduledTransferLineItemOption > = z.object({ name: z.string(), quantity: z.number().int(), priceModifier: AmountDecimal$outboundSchema.optional(), group: z.string().optional(), images: z.array(ScheduledTransferImageMetadata$outboundSchema).optional(), }); export function scheduledTransferLineItemOptionToJSON( scheduledTransferLineItemOption: ScheduledTransferLineItemOption, ): string { return JSON.stringify( ScheduledTransferLineItemOption$outboundSchema.parse( scheduledTransferLineItemOption, ), ); } export function scheduledTransferLineItemOptionFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => ScheduledTransferLineItemOption$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'ScheduledTransferLineItemOption' from JSON`, ); }