/* * 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"; import { CustomField, CustomField$inboundSchema } from "./customfield.js"; import { LinkedInvoiceItem, LinkedInvoiceItem$inboundSchema, } from "./linkedinvoiceitem.js"; import { LinkedPurchaseOrder, LinkedPurchaseOrder$inboundSchema, } from "./linkedpurchaseorder.js"; import { LinkedTrackingCategory, LinkedTrackingCategory$inboundSchema, } from "./linkedtrackingcategory.js"; export type GoodsReceiptLineItem = { /** * A unique identifier for an object. */ id?: string | undefined; /** * Line number of the resource */ lineNumber?: number | null | undefined; purchaseOrder?: LinkedPurchaseOrder | null | undefined; item?: LinkedInvoiceItem | undefined; /** * Description of the received item as recorded on the receipt line. */ description?: string | null | undefined; /** * Quantity received on this line, in the line's unit of measure. */ quantityReceived?: number | null | undefined; /** * Quantity ordered on the linked purchase order line, when the accounting system exposes it on the receipt line. */ quantityOrdered?: number | null | undefined; /** * Description of the unit type the item is sold as, ie: kg, hour. */ unitOfMeasure?: string | null | undefined; unitPrice?: number | null | undefined; /** * Value of the received quantity on this line, when the accounting system records a cost on the receipt. */ totalAmount?: number | null | undefined; /** * ID of the warehouse, storage location or bin the line was received into. */ locationId?: string | null | undefined; /** * A list of linked tracking categories. */ trackingCategories?: Array | null | undefined; customFields?: Array | undefined; /** * A binary value used to detect updates to a object and prevent data conflicts. It is incremented each time an update is made to the object. */ rowVersion?: string | null | undefined; /** * The user who last updated the object. */ updatedBy?: string | null | undefined; /** * The user who created the object. */ createdBy?: string | null | undefined; /** * The date and time when the object was last updated. */ updatedAt?: Date | null | undefined; /** * The date and time when the object was created. */ createdAt?: Date | null | undefined; }; /** @internal */ export const GoodsReceiptLineItem$inboundSchema: z.ZodType< GoodsReceiptLineItem, z.ZodTypeDef, unknown > = /* @__PURE__ */ lazySchema$(() => z.object({ id: types.optional(types.string()), line_number: z.nullable(types.number()).optional(), purchase_order: z.nullable(LinkedPurchaseOrder$inboundSchema).optional(), item: types.optional(LinkedInvoiceItem$inboundSchema), description: z.nullable(types.string()).optional(), quantity_received: z.nullable(types.number()).optional(), quantity_ordered: z.nullable(types.number()).optional(), unit_of_measure: z.nullable(types.string()).optional(), unit_price: z.nullable(types.number()).optional(), total_amount: z.nullable(types.number()).optional(), location_id: z.nullable(types.string()).optional(), tracking_categories: z.nullable( z.array(types.nullable(LinkedTrackingCategory$inboundSchema)), ).optional(), custom_fields: types.optional(z.array(CustomField$inboundSchema)), row_version: z.nullable(types.string()).optional(), updated_by: z.nullable(types.string()).optional(), created_by: z.nullable(types.string()).optional(), updated_at: z.nullable(types.date()).optional(), created_at: z.nullable(types.date()).optional(), }).transform((v) => { return remap$(v, { "line_number": "lineNumber", "purchase_order": "purchaseOrder", "quantity_received": "quantityReceived", "quantity_ordered": "quantityOrdered", "unit_of_measure": "unitOfMeasure", "unit_price": "unitPrice", "total_amount": "totalAmount", "location_id": "locationId", "tracking_categories": "trackingCategories", "custom_fields": "customFields", "row_version": "rowVersion", "updated_by": "updatedBy", "created_by": "createdBy", "updated_at": "updatedAt", "created_at": "createdAt", }); }) ); export function goodsReceiptLineItemFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => GoodsReceiptLineItem$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'GoodsReceiptLineItem' from JSON`, ); }