/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ import * as z from "zod/v3"; import { remap as remap$ } from "../../lib/primitives.js"; import { lazySchema as lazySchema$, safeParse } from "../../lib/schemas.js"; import { Result as SafeParseResult } from "../../types/fp.js"; import * as types from "../../types/primitives.js"; import { SDKValidationError } from "../errors/sdkvalidationerror.js"; export type LinkedPurchaseOrder = { /** * The unique identifier for the purchase order. */ id?: string | undefined; /** * The unique identifier for the purchase order line. */ lineId?: string | null | undefined; /** * The line number of the purchase order line. */ lineNumber?: string | null | undefined; }; /** @internal */ export const LinkedPurchaseOrder$inboundSchema: z.ZodType< LinkedPurchaseOrder, z.ZodTypeDef, unknown > = /* @__PURE__ */ lazySchema$(() => z.object({ id: types.optional(types.string()), line_id: z.nullable(types.string()).optional(), line_number: z.nullable(types.string()).optional(), }).transform((v) => { return remap$(v, { "line_id": "lineId", "line_number": "lineNumber", }); }) ); /** @internal */ export type LinkedPurchaseOrder$Outbound = { id?: string | undefined; line_id?: string | null | undefined; line_number?: string | null | undefined; }; /** @internal */ export const LinkedPurchaseOrder$outboundSchema: z.ZodType< LinkedPurchaseOrder$Outbound, z.ZodTypeDef, LinkedPurchaseOrder > = /* @__PURE__ */ lazySchema$(() => z.object({ id: z.string().optional(), lineId: z.nullable(z.string()).optional(), lineNumber: z.nullable(z.string()).optional(), }).transform((v) => { return remap$(v, { lineId: "line_id", lineNumber: "line_number", }); }) ); export function linkedPurchaseOrderToJSON( linkedPurchaseOrder: LinkedPurchaseOrder, ): string { return JSON.stringify( LinkedPurchaseOrder$outboundSchema.parse(linkedPurchaseOrder), ); } export function linkedPurchaseOrderFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => LinkedPurchaseOrder$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'LinkedPurchaseOrder' from JSON`, ); }