/* * 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$ } from "../../lib/schemas.js"; import { LineItemType, LineItemType$outboundSchema } from "./lineitemtype.js"; import { LinkedDepartmentInput, LinkedDepartmentInput$Outbound, LinkedDepartmentInput$outboundSchema, } from "./linkeddepartmentinput.js"; import { LinkedInvoiceItem, LinkedInvoiceItem$Outbound, LinkedInvoiceItem$outboundSchema, } from "./linkedinvoiceitem.js"; import { LinkedLedgerAccount, LinkedLedgerAccount$Outbound, LinkedLedgerAccount$outboundSchema, } from "./linkedledgeraccount.js"; import { LinkedLocationInput, LinkedLocationInput$Outbound, LinkedLocationInput$outboundSchema, } from "./linkedlocationinput.js"; import { LinkedTaxRateInput, LinkedTaxRateInput$Outbound, LinkedTaxRateInput$outboundSchema, } from "./linkedtaxrateinput.js"; import { LinkedTrackingCategory, LinkedTrackingCategory$Outbound, LinkedTrackingCategory$outboundSchema, } from "./linkedtrackingcategory.js"; export type BillCreditNoteLineItemInput = { /** * 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?: LinkedLocationInput | null | undefined; department?: LinkedDepartmentInput | null | undefined; item?: LinkedInvoiceItem | undefined; taxRate?: LinkedTaxRateInput | 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; }; /** @internal */ export type BillCreditNoteLineItemInput$Outbound = { row_id?: string | null | undefined; code?: string | null | undefined; line_number?: number | null | undefined; description?: string | null | undefined; type?: string | null | undefined; tax_amount?: number | null | undefined; total_amount?: number | null | undefined; quantity?: number | null | undefined; unit_price?: number | null | undefined; unit_of_measure?: string | null | undefined; discount_percentage?: number | null | undefined; discount_amount?: number | null | undefined; service_date?: string | null | undefined; location?: LinkedLocationInput$Outbound | null | undefined; department?: LinkedDepartmentInput$Outbound | null | undefined; item?: LinkedInvoiceItem$Outbound | undefined; tax_rate?: LinkedTaxRateInput$Outbound | undefined; ledger_account?: LinkedLedgerAccount$Outbound | null | undefined; tracking_categories?: | Array | null | undefined; row_version?: string | null | undefined; }; /** @internal */ export const BillCreditNoteLineItemInput$outboundSchema: z.ZodType< BillCreditNoteLineItemInput$Outbound, z.ZodTypeDef, BillCreditNoteLineItemInput > = /* @__PURE__ */ lazySchema$(() => z.object({ rowId: z.nullable(z.string()).optional(), code: z.nullable(z.string()).optional(), lineNumber: z.nullable(z.number().int()).optional(), description: z.nullable(z.string()).optional(), type: z.nullable(LineItemType$outboundSchema).optional(), taxAmount: z.nullable(z.number()).optional(), totalAmount: z.nullable(z.number()).optional(), quantity: z.nullable(z.number()).optional(), unitPrice: z.nullable(z.number()).optional(), unitOfMeasure: z.nullable(z.string()).optional(), discountPercentage: z.nullable(z.number()).optional(), discountAmount: z.nullable(z.number()).optional(), serviceDate: z.nullable( z.date().transform(v => v.toISOString().slice(0, "YYYY-MM-DD".length)), ).optional(), location: z.nullable(LinkedLocationInput$outboundSchema).optional(), department: z.nullable(LinkedDepartmentInput$outboundSchema).optional(), item: LinkedInvoiceItem$outboundSchema.optional(), taxRate: LinkedTaxRateInput$outboundSchema.optional(), ledgerAccount: z.nullable(LinkedLedgerAccount$outboundSchema).optional(), trackingCategories: z.nullable( z.array(z.nullable(LinkedTrackingCategory$outboundSchema)), ).optional(), rowVersion: z.nullable(z.string()).optional(), }).transform((v) => { return remap$(v, { rowId: "row_id", lineNumber: "line_number", taxAmount: "tax_amount", totalAmount: "total_amount", unitPrice: "unit_price", unitOfMeasure: "unit_of_measure", discountPercentage: "discount_percentage", discountAmount: "discount_amount", serviceDate: "service_date", taxRate: "tax_rate", ledgerAccount: "ledger_account", trackingCategories: "tracking_categories", rowVersion: "row_version", }); }) ); export function billCreditNoteLineItemInputToJSON( billCreditNoteLineItemInput: BillCreditNoteLineItemInput, ): string { return JSON.stringify( BillCreditNoteLineItemInput$outboundSchema.parse( billCreditNoteLineItemInput, ), ); }