/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ import * as z from "zod/v4-mini"; import { remap as remap$ } from "../../lib/primitives.js"; import { safeParse } from "../../lib/schemas.js"; import { Result as SafeParseResult } from "../../types/fp.js"; import * as types from "../../types/primitives.js"; import { InvoiceLineItemPreview, InvoiceLineItemPreview$inboundSchema, } from "./invoice-line-item-preview.js"; import { SDKValidationError } from "./sdk-validation-error.js"; export type InvoicePreview = { /** * currency is the currency for all amounts */ currency?: string | undefined; /** * due_date is when the invoice would be due */ dueDate?: Date | undefined; /** * line_items contains preview of line items */ lineItems?: Array | undefined; /** * subtotal is the subtotal amount before taxes */ subtotal?: string | undefined; /** * tax_amount is the total tax amount */ taxAmount?: string | undefined; /** * total is the total amount including taxes */ total?: string | undefined; }; /** @internal */ export const InvoicePreview$inboundSchema: z.ZodMiniType< InvoicePreview, unknown > = z.pipe( z.object({ currency: types.optional(types.string()), due_date: types.optional(types.date()), line_items: types.optional(z.array(InvoiceLineItemPreview$inboundSchema)), subtotal: types.optional(types.string()), tax_amount: types.optional(types.string()), total: types.optional(types.string()), }), z.transform((v) => { return remap$(v, { "due_date": "dueDate", "line_items": "lineItems", "tax_amount": "taxAmount", }); }), ); export function invoicePreviewFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => InvoicePreview$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'InvoicePreview' from JSON`, ); }