/* * 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 { LineItemType, LineItemType$inboundSchema } from "./lineitemtype.js"; import { LinkedCustomer, LinkedCustomer$inboundSchema, } from "./linkedcustomer.js"; import { LinkedDepartment, LinkedDepartment$inboundSchema, } from "./linkeddepartment.js"; import { LinkedInvoiceItem, LinkedInvoiceItem$inboundSchema, } from "./linkedinvoiceitem.js"; import { LinkedLedgerAccount, LinkedLedgerAccount$inboundSchema, } from "./linkedledgeraccount.js"; import { LinkedLocation, LinkedLocation$inboundSchema, } from "./linkedlocation.js"; import { LinkedTaxRate, LinkedTaxRate$inboundSchema } from "./linkedtaxrate.js"; import { LinkedTrackingCategory, LinkedTrackingCategory$inboundSchema, } from "./linkedtrackingcategory.js"; import { Rebilling, Rebilling$inboundSchema } from "./rebilling.js"; export type ExpenseLineItem = { /** * A unique identifier for an object. */ id?: string | undefined; /** * A list of linked tracking categories. */ trackingCategories?: Array | null | undefined; /** * The unique identifier for the ledger account. Deprecated, use account instead. * * @deprecated field: Deprecated. Use account instead.. */ accountId?: string | undefined; account?: LinkedLedgerAccount | null | undefined; /** * The ID of the customer this expense item is linked to. Deprecated in favor of `customer`. * * @deprecated field: Deprecated. Use customer instead.. */ customerId?: string | undefined; /** * The customer this entity is linked to. */ customer?: LinkedCustomer | null | undefined; /** * The ID of the department */ departmentId?: string | null | undefined; department?: LinkedDepartment | null | undefined; /** * The ID of the location */ locationId?: string | null | undefined; location?: LinkedLocation | null | undefined; taxRate?: LinkedTaxRate | undefined; /** * The expense line item description */ description?: string | null | undefined; /** * Line Item type */ type?: LineItemType | null | undefined; /** * The total amount of the expense line item. */ totalAmount: number | null; /** * Tax amount */ taxAmount?: number | null | undefined; quantity?: number | null | undefined; unitPrice?: number | null | undefined; item?: LinkedInvoiceItem | undefined; /** * Line number of the resource */ lineNumber?: number | null | undefined; /** * Rebilling metadata for this line item. */ rebilling?: Rebilling | null | undefined; }; /** @internal */ export const ExpenseLineItem$inboundSchema: z.ZodType< ExpenseLineItem, z.ZodTypeDef, unknown > = /* @__PURE__ */ lazySchema$(() => z.object({ id: types.optional(types.string()), tracking_categories: z.nullable( z.array(types.nullable(LinkedTrackingCategory$inboundSchema)), ).optional(), account_id: types.optional(types.string()), account: z.nullable(LinkedLedgerAccount$inboundSchema).optional(), customer_id: types.optional(types.string()), customer: z.nullable(LinkedCustomer$inboundSchema).optional(), department_id: z.nullable(types.string()).optional(), department: z.nullable(LinkedDepartment$inboundSchema).optional(), location_id: z.nullable(types.string()).optional(), location: z.nullable(LinkedLocation$inboundSchema).optional(), tax_rate: types.optional(LinkedTaxRate$inboundSchema), description: z.nullable(types.string()).optional(), type: z.nullable(LineItemType$inboundSchema).optional(), total_amount: types.nullable(types.number()), tax_amount: z.nullable(types.number()).optional(), quantity: z.nullable(types.number()).optional(), unit_price: z.nullable(types.number()).optional(), item: types.optional(LinkedInvoiceItem$inboundSchema), line_number: z.nullable(types.number()).optional(), rebilling: z.nullable(Rebilling$inboundSchema).optional(), }).transform((v) => { return remap$(v, { "tracking_categories": "trackingCategories", "account_id": "accountId", "customer_id": "customerId", "department_id": "departmentId", "location_id": "locationId", "tax_rate": "taxRate", "total_amount": "totalAmount", "tax_amount": "taxAmount", "unit_price": "unitPrice", "line_number": "lineNumber", }); }) ); export function expenseLineItemFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => ExpenseLineItem$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'ExpenseLineItem' from JSON`, ); }