/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ import * as z from "zod"; import { remap as remap$ } from "../../lib/primitives.js"; import { safeParse } from "../../lib/schemas.js"; import { Result as SafeParseResult } from "../../types/fp.js"; import { SDKValidationError } from "../errors/sdkvalidationerror.js"; import { LinkedTaxRateInput, LinkedTaxRateInput$inboundSchema, LinkedTaxRateInput$Outbound, LinkedTaxRateInput$outboundSchema, } from "./linkedtaxrateinput.js"; import { LinkedTrackingCategory, LinkedTrackingCategory$inboundSchema, LinkedTrackingCategory$Outbound, LinkedTrackingCategory$outboundSchema, } from "./linkedtrackingcategory.js"; export type ExpenseLineItemInput = { /** * A list of linked tracking categories. */ trackingCategories?: Array | null | undefined; /** * The unique identifier for the ledger account. */ accountId?: string | undefined; /** * The ID of the customer this expense item is linked to. */ customerId?: string | undefined; /** * The ID of the department this expense item is linked to. */ departmentId?: string | undefined; /** * The ID of the location this expense item is linked to. */ locationId?: string | undefined; taxRate?: LinkedTaxRateInput | undefined; /** * The expense line item description */ description?: string | null | undefined; /** * The total amount of the expense line item. */ totalAmount: number | null; /** * Boolean that indicates if the line item is billable or not. */ billable?: boolean | undefined; }; /** @internal */ export const ExpenseLineItemInput$inboundSchema: z.ZodType< ExpenseLineItemInput, z.ZodTypeDef, unknown > = z.object({ tracking_categories: z.nullable(z.array(LinkedTrackingCategory$inboundSchema)) .optional(), account_id: z.string().optional(), customer_id: z.string().optional(), department_id: z.string().optional(), location_id: z.string().optional(), tax_rate: LinkedTaxRateInput$inboundSchema.optional(), description: z.nullable(z.string()).optional(), total_amount: z.nullable(z.number()), billable: z.boolean().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", }); }); /** @internal */ export type ExpenseLineItemInput$Outbound = { tracking_categories?: | Array | null | undefined; account_id?: string | undefined; customer_id?: string | undefined; department_id?: string | undefined; location_id?: string | undefined; tax_rate?: LinkedTaxRateInput$Outbound | undefined; description?: string | null | undefined; total_amount: number | null; billable?: boolean | undefined; }; /** @internal */ export const ExpenseLineItemInput$outboundSchema: z.ZodType< ExpenseLineItemInput$Outbound, z.ZodTypeDef, ExpenseLineItemInput > = z.object({ trackingCategories: z.nullable(z.array(LinkedTrackingCategory$outboundSchema)) .optional(), accountId: z.string().optional(), customerId: z.string().optional(), departmentId: z.string().optional(), locationId: z.string().optional(), taxRate: LinkedTaxRateInput$outboundSchema.optional(), description: z.nullable(z.string()).optional(), totalAmount: z.nullable(z.number()), billable: z.boolean().optional(), }).transform((v) => { return remap$(v, { trackingCategories: "tracking_categories", accountId: "account_id", customerId: "customer_id", departmentId: "department_id", locationId: "location_id", taxRate: "tax_rate", totalAmount: "total_amount", }); }); /** * @internal * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. */ export namespace ExpenseLineItemInput$ { /** @deprecated use `ExpenseLineItemInput$inboundSchema` instead. */ export const inboundSchema = ExpenseLineItemInput$inboundSchema; /** @deprecated use `ExpenseLineItemInput$outboundSchema` instead. */ export const outboundSchema = ExpenseLineItemInput$outboundSchema; /** @deprecated use `ExpenseLineItemInput$Outbound` instead. */ export type Outbound = ExpenseLineItemInput$Outbound; } export function expenseLineItemInputToJSON( expenseLineItemInput: ExpenseLineItemInput, ): string { return JSON.stringify( ExpenseLineItemInput$outboundSchema.parse(expenseLineItemInput), ); } export function expenseLineItemInputFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => ExpenseLineItemInput$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'ExpenseLineItemInput' from JSON`, ); }