/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ import * as z from "zod"; import { safeParse } from "../../lib/schemas.js"; import { Result as SafeParseResult } from "../../types/fp.js"; import { SDKValidationError } from "../errors/sdkvalidationerror.js"; import { EcommerceOrderStatus, EcommerceOrderStatus$inboundSchema, EcommerceOrderStatus$outboundSchema, } from "./ecommerceorderstatus.js"; /** * The order this entity is linked to. */ export type LinkedEcommerceOrder = { /** * A unique identifier for an object. */ id?: string | undefined; /** * The total amount of the order. */ total?: string | null | undefined; /** * Current status of the order. */ status?: EcommerceOrderStatus | null | undefined; }; /** @internal */ export const LinkedEcommerceOrder$inboundSchema: z.ZodType< LinkedEcommerceOrder, z.ZodTypeDef, unknown > = z.object({ id: z.string().optional(), total: z.nullable(z.string()).optional(), status: z.nullable(EcommerceOrderStatus$inboundSchema).optional(), }); /** @internal */ export type LinkedEcommerceOrder$Outbound = { id?: string | undefined; total?: string | null | undefined; status?: string | null | undefined; }; /** @internal */ export const LinkedEcommerceOrder$outboundSchema: z.ZodType< LinkedEcommerceOrder$Outbound, z.ZodTypeDef, LinkedEcommerceOrder > = z.object({ id: z.string().optional(), total: z.nullable(z.string()).optional(), status: z.nullable(EcommerceOrderStatus$outboundSchema).optional(), }); /** * @internal * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. */ export namespace LinkedEcommerceOrder$ { /** @deprecated use `LinkedEcommerceOrder$inboundSchema` instead. */ export const inboundSchema = LinkedEcommerceOrder$inboundSchema; /** @deprecated use `LinkedEcommerceOrder$outboundSchema` instead. */ export const outboundSchema = LinkedEcommerceOrder$outboundSchema; /** @deprecated use `LinkedEcommerceOrder$Outbound` instead. */ export type Outbound = LinkedEcommerceOrder$Outbound; } export function linkedEcommerceOrderToJSON( linkedEcommerceOrder: LinkedEcommerceOrder, ): string { return JSON.stringify( LinkedEcommerceOrder$outboundSchema.parse(linkedEcommerceOrder), ); } export function linkedEcommerceOrderFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => LinkedEcommerceOrder$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'LinkedEcommerceOrder' from JSON`, ); }