/* * 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 { LineItemType, LineItemType$inboundSchema } from "./lineitemtype.js"; import { LinkedCustomer, LinkedCustomer$inboundSchema, } from "./linkedcustomer.js"; import { LinkedInvoiceItem, LinkedInvoiceItem$inboundSchema, } from "./linkedinvoiceitem.js"; import { LinkedLedgerAccount, LinkedLedgerAccount$inboundSchema, } from "./linkedledgeraccount.js"; import { LinkedPurchaseOrder, LinkedPurchaseOrder$inboundSchema, } from "./linkedpurchaseorder.js"; import { LinkedTaxRate, LinkedTaxRate$inboundSchema } from "./linkedtaxrate.js"; import { LinkedTrackingCategory, LinkedTrackingCategory$inboundSchema, } from "./linkedtrackingcategory.js"; import { LinkedWorktag, LinkedWorktag$inboundSchema } from "./linkedworktag.js"; import { Rebilling, Rebilling$inboundSchema } from "./rebilling.js"; export type BillLineItem = { /** * A unique identifier for an object. */ id?: string | undefined; /** * Row ID */ rowId?: string | undefined; /** * User defined item code */ code?: string | null | undefined; /** * Line number of the resource */ lineNumber?: number | null | undefined; /** * User defined description */ description?: string | null | undefined; /** * Line Item type */ type?: LineItemType | null | undefined; /** * Tax amount */ taxAmount?: number | null | undefined; /** * Total amount of the line item */ totalAmount?: number | null | undefined; quantity?: number | null | undefined; unitPrice?: number | null | undefined; /** * Description of the unit type the item is sold as, ie: kg, hour. */ unitOfMeasure?: string | null | undefined; /** * Discount percentage applied to the line item when supported downstream. */ discountPercentage?: number | null | undefined; /** * Discount amount applied to the line item when supported downstream. */ discountAmount?: number | null | undefined; /** * The ID of the location */ locationId?: string | null | undefined; /** * The ID of the department */ departmentId?: string | null | undefined; /** * The ID of the subsidiary */ subsidiaryId?: string | null | undefined; /** * ID of the category of the line item */ categoryId?: string | null | undefined; /** * ID of the shipping of the line item */ shippingId?: string | null | undefined; /** * Memo */ memo?: string | null | undefined; /** * Whether the line item is prepaid */ prepaid?: boolean | null | undefined; /** * Tax applicable on */ taxApplicableOn?: string | null | undefined; /** * Tax recoverability */ taxRecoverability?: string | null | undefined; /** * Method of tax calculation */ taxMethod?: string | null | undefined; /** * Retention amount */ retentionAmount?: number | null | undefined; /** * Payment amount */ paymentAmount?: number | null | undefined; item?: LinkedInvoiceItem | undefined; taxRate?: LinkedTaxRate | undefined; ledgerAccount?: LinkedLedgerAccount | null | undefined; purchaseOrder?: LinkedPurchaseOrder | null | undefined; customFields?: Array | undefined; /** * A list of linked tracking categories. */ trackingCategories?: Array | null | undefined; /** * The customer this entity is linked to. */ customer?: LinkedCustomer | null | undefined; /** * Rebilling metadata for this line item. */ rebilling?: Rebilling | null | 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 created. */ createdAt?: Date | null | undefined; /** * The date and time when the object was last updated. */ updatedAt?: Date | null | undefined; /** * A list of linked worktags. This is only supported for Workday. */ worktags?: Array | undefined; }; /** @internal */ export const BillLineItem$inboundSchema: z.ZodType< BillLineItem, z.ZodTypeDef, unknown > = /* @__PURE__ */ lazySchema$(() => z.object({ id: types.optional(types.string()), row_id: types.optional(types.string()), code: z.nullable(types.string()).optional(), line_number: z.nullable(types.number()).optional(), description: z.nullable(types.string()).optional(), type: z.nullable(LineItemType$inboundSchema).optional(), tax_amount: z.nullable(types.number()).optional(), total_amount: z.nullable(types.number()).optional(), quantity: z.nullable(types.number()).optional(), unit_price: z.nullable(types.number()).optional(), unit_of_measure: z.nullable(types.string()).optional(), discount_percentage: z.nullable(types.number()).optional(), discount_amount: z.nullable(types.number()).optional(), location_id: z.nullable(types.string()).optional(), department_id: z.nullable(types.string()).optional(), subsidiary_id: z.nullable(types.string()).optional(), category_id: z.nullable(types.string()).optional(), shipping_id: z.nullable(types.string()).optional(), memo: z.nullable(types.string()).optional(), prepaid: z.nullable(types.boolean()).optional(), tax_applicable_on: z.nullable(types.string()).optional(), tax_recoverability: z.nullable(types.string()).optional(), tax_method: z.nullable(types.string()).optional(), retention_amount: z.nullable(types.number()).optional(), payment_amount: z.nullable(types.number()).optional(), item: types.optional(LinkedInvoiceItem$inboundSchema), tax_rate: types.optional(LinkedTaxRate$inboundSchema), ledger_account: z.nullable(LinkedLedgerAccount$inboundSchema).optional(), purchase_order: z.nullable(LinkedPurchaseOrder$inboundSchema).optional(), custom_fields: types.optional(z.array(CustomField$inboundSchema)), tracking_categories: z.nullable( z.array(types.nullable(LinkedTrackingCategory$inboundSchema)), ).optional(), customer: z.nullable(LinkedCustomer$inboundSchema).optional(), rebilling: z.nullable(Rebilling$inboundSchema).optional(), row_version: z.nullable(types.string()).optional(), updated_by: z.nullable(types.string()).optional(), created_by: z.nullable(types.string()).optional(), created_at: z.nullable(types.date()).optional(), updated_at: z.nullable(types.date()).optional(), worktags: types.optional( z.array(types.nullable(LinkedWorktag$inboundSchema)), ), }).transform((v) => { return remap$(v, { "row_id": "rowId", "line_number": "lineNumber", "tax_amount": "taxAmount", "total_amount": "totalAmount", "unit_price": "unitPrice", "unit_of_measure": "unitOfMeasure", "discount_percentage": "discountPercentage", "discount_amount": "discountAmount", "location_id": "locationId", "department_id": "departmentId", "subsidiary_id": "subsidiaryId", "category_id": "categoryId", "shipping_id": "shippingId", "tax_applicable_on": "taxApplicableOn", "tax_recoverability": "taxRecoverability", "tax_method": "taxMethod", "retention_amount": "retentionAmount", "payment_amount": "paymentAmount", "tax_rate": "taxRate", "ledger_account": "ledgerAccount", "purchase_order": "purchaseOrder", "custom_fields": "customFields", "tracking_categories": "trackingCategories", "row_version": "rowVersion", "updated_by": "updatedBy", "created_by": "createdBy", "created_at": "createdAt", "updated_at": "updatedAt", }); }) ); export function billLineItemFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => BillLineItem$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'BillLineItem' from JSON`, ); }