/* * 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 { Currency, Currency$inboundSchema } from "./currency.js"; import { LinkedCustomer, LinkedCustomer$inboundSchema, } from "./linkedcustomer.js"; import { LinkedDepartment, LinkedDepartment$inboundSchema, } from "./linkeddepartment.js"; import { LinkedExpenseCategory, LinkedExpenseCategory$inboundSchema, } from "./linkedexpensecategory.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"; export type ExpenseReportLineItem = { /** * A unique identifier for an object. */ id?: string | undefined; /** * Line number of the resource */ lineNumber?: number | null | undefined; /** * The expense category this entity is linked to. */ expenseCategory?: LinkedExpenseCategory | undefined; account?: LinkedLedgerAccount | null | undefined; /** * The description of the expense line item. */ description?: string | null | undefined; quantity?: number | null | undefined; unitPrice?: number | null | undefined; /** * The amount of the expense line item. */ amount: number; taxRate?: LinkedTaxRate | undefined; /** * Tax amount */ taxAmount?: number | null | undefined; /** * The total amount of the expense line item including tax. */ totalAmount?: number | null | undefined; /** * The date of the individual expense. */ transactionDate?: Date | null | undefined; /** * Whether the expense is billable to a customer. */ billable?: boolean | null | undefined; /** * Whether the expense is reimbursable to the employee. */ reimbursable?: boolean | null | undefined; /** * The customer this entity is linked to. */ customer?: LinkedCustomer | null | undefined; department?: LinkedDepartment | null | undefined; location?: LinkedLocation | null | undefined; /** * A list of linked tracking categories. */ trackingCategories?: Array | null | undefined; /** * URL to the receipt or attachment for this expense line. */ receiptUrl?: string | null | undefined; /** * Indicates the associated currency for an amount of money. Values correspond to [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217). */ currency?: Currency | 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 ExpenseReportLineItem$inboundSchema: z.ZodType< ExpenseReportLineItem, z.ZodTypeDef, unknown > = /* @__PURE__ */ lazySchema$(() => z.object({ id: types.optional(types.string()), line_number: z.nullable(types.number()).optional(), expense_category: types.optional(LinkedExpenseCategory$inboundSchema), account: z.nullable(LinkedLedgerAccount$inboundSchema).optional(), description: z.nullable(types.string()).optional(), quantity: z.nullable(types.number()).optional(), unit_price: z.nullable(types.number()).optional(), amount: types.number(), tax_rate: types.optional(LinkedTaxRate$inboundSchema), tax_amount: z.nullable(types.number()).optional(), total_amount: z.nullable(types.number()).optional(), transaction_date: z.nullable(types.date()).optional(), billable: z.nullable(types.boolean()).optional(), reimbursable: z.nullable(types.boolean()).optional(), customer: z.nullable(LinkedCustomer$inboundSchema).optional(), department: z.nullable(LinkedDepartment$inboundSchema).optional(), location: z.nullable(LinkedLocation$inboundSchema).optional(), tracking_categories: z.nullable( z.array(types.nullable(LinkedTrackingCategory$inboundSchema)), ).optional(), receipt_url: z.nullable(types.string()).optional(), currency: z.nullable(Currency$inboundSchema).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", "expense_category": "expenseCategory", "unit_price": "unitPrice", "tax_rate": "taxRate", "tax_amount": "taxAmount", "total_amount": "totalAmount", "transaction_date": "transactionDate", "tracking_categories": "trackingCategories", "receipt_url": "receiptUrl", "updated_by": "updatedBy", "created_by": "createdBy", "updated_at": "updatedAt", "created_at": "createdAt", }); }) ); export function expenseReportLineItemFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => ExpenseReportLineItem$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'ExpenseReportLineItem' from JSON`, ); }