/* * 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 { 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"; export type BillCreditNoteLineItem = { /** * A unique identifier for an object. */ id?: string | undefined; /** * The unique row identifier of the line item, when the connector exposes one. */ rowId?: string | null | undefined; /** * User defined item code. */ code?: string | null | undefined; /** * Line number of the resource */ lineNumber?: number | null | undefined; /** * User defined description for the line item. */ 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; /** * Date on which the service was provided or performed - YYYY-MM-DD. */ serviceDate?: Date | null | undefined; location?: LinkedLocation | null | undefined; department?: LinkedDepartment | null | undefined; item?: LinkedInvoiceItem | undefined; taxRate?: LinkedTaxRate | undefined; ledgerAccount?: LinkedLedgerAccount | null | undefined; /** * A list of linked tracking categories. */ trackingCategories?: Array | 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; }; /** @internal */ export const BillCreditNoteLineItem$inboundSchema: z.ZodType< BillCreditNoteLineItem, z.ZodTypeDef, unknown > = /* @__PURE__ */ lazySchema$(() => z.object({ id: types.optional(types.string()), row_id: z.nullable(types.string()).optional(), 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(), service_date: z.nullable(types.date()).optional(), location: z.nullable(LinkedLocation$inboundSchema).optional(), department: z.nullable(LinkedDepartment$inboundSchema).optional(), item: types.optional(LinkedInvoiceItem$inboundSchema), tax_rate: types.optional(LinkedTaxRate$inboundSchema), ledger_account: z.nullable(LinkedLedgerAccount$inboundSchema).optional(), tracking_categories: z.nullable( z.array(types.nullable(LinkedTrackingCategory$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(), }).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", "service_date": "serviceDate", "tax_rate": "taxRate", "ledger_account": "ledgerAccount", "tracking_categories": "trackingCategories", "row_version": "rowVersion", "updated_by": "updatedBy", "created_by": "createdBy", "created_at": "createdAt", "updated_at": "updatedAt", }); }) ); export function billCreditNoteLineItemFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => BillCreditNoteLineItem$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'BillCreditNoteLineItem' from JSON`, ); }