/* * 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 { CreateScheduledTransferLineItemOption, CreateScheduledTransferLineItemOption$inboundSchema, CreateScheduledTransferLineItemOption$Outbound, CreateScheduledTransferLineItemOption$outboundSchema, } from "./createscheduledtransferlineitemoption.js"; /** * Represents a single item in a scheduled transfer, including optional modifiers and quantity. */ export type CreateScheduledTransferLineItem = { /** * The name of the item. */ name: string; /** * The base price of the item before applying option modifiers. */ basePrice: AmountDecimal; /** * The quantity of this item. */ quantity: number; /** * Optional list of modifiers applied to this item (e.g., toppings, upgrades, customizations). */ options?: Array | undefined; /** * Optional unique identifier associating the line item with a product. */ productID?: string | undefined; /** * Optional list of images associated with this line item. */ imageIDs?: Array | undefined; }; /** @internal */ export const CreateScheduledTransferLineItem$inboundSchema: z.ZodType< CreateScheduledTransferLineItem, z.ZodTypeDef, unknown > = z.object({ name: z.string(), basePrice: AmountDecimal$inboundSchema, quantity: z.number().int(), options: z.array(CreateScheduledTransferLineItemOption$inboundSchema) .optional(), productID: z.string().optional(), imageIDs: z.array(z.string()).optional(), }); /** @internal */ export type CreateScheduledTransferLineItem$Outbound = { name: string; basePrice: AmountDecimal$Outbound; quantity: number; options?: Array | undefined; productID?: string | undefined; imageIDs?: Array | undefined; }; /** @internal */ export const CreateScheduledTransferLineItem$outboundSchema: z.ZodType< CreateScheduledTransferLineItem$Outbound, z.ZodTypeDef, CreateScheduledTransferLineItem > = z.object({ name: z.string(), basePrice: AmountDecimal$outboundSchema, quantity: z.number().int(), options: z.array(CreateScheduledTransferLineItemOption$outboundSchema) .optional(), productID: z.string().optional(), imageIDs: z.array(z.string()).optional(), }); export function createScheduledTransferLineItemToJSON( createScheduledTransferLineItem: CreateScheduledTransferLineItem, ): string { return JSON.stringify( CreateScheduledTransferLineItem$outboundSchema.parse( createScheduledTransferLineItem, ), ); } export function createScheduledTransferLineItemFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => CreateScheduledTransferLineItem$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'CreateScheduledTransferLineItem' from JSON`, ); }