/* * 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 * as openEnums from "../../types/enums.js"; import { OpenEnum } from "../../types/enums.js"; import { Result as SafeParseResult } from "../../types/fp.js"; import * as types from "../../types/primitives.js"; import { SDKValidationError } from "../errors/sdkvalidationerror.js"; /** * Status of the rebilling process for this line item. */ export const RebillStatus = { Pending: "pending", Billed: "billed", Voided: "voided", Other: "other", } as const; /** * Status of the rebilling process for this line item. */ export type RebillStatus = OpenEnum; /** * Rebilling metadata for this line item. */ export type Rebilling = { /** * Whether this line item is eligible for rebilling. */ rebillable?: boolean | undefined; /** * Status of the rebilling process for this line item. */ rebillStatus?: RebillStatus | null | undefined; /** * The ID of the transaction this line item was rebilled to. */ linkedTransactionId?: string | null | undefined; /** * The ID of the line item in the rebilled transaction. */ linkedTransactionLineId?: string | null | undefined; }; /** @internal */ export const RebillStatus$inboundSchema: z.ZodType< RebillStatus, z.ZodTypeDef, unknown > = /* @__PURE__ */ lazySchema$(() => openEnums.inboundSchema(RebillStatus)); /** @internal */ export const RebillStatus$outboundSchema: z.ZodType< string, z.ZodTypeDef, RebillStatus > = /* @__PURE__ */ lazySchema$(() => openEnums.outboundSchema(RebillStatus)); /** @internal */ export const Rebilling$inboundSchema: z.ZodType< Rebilling, z.ZodTypeDef, unknown > = /* @__PURE__ */ lazySchema$(() => z.object({ rebillable: types.optional(types.boolean()), rebill_status: z.nullable(RebillStatus$inboundSchema).optional(), linked_transaction_id: z.nullable(types.string()).optional(), linked_transaction_line_id: z.nullable(types.string()).optional(), }).transform((v) => { return remap$(v, { "rebill_status": "rebillStatus", "linked_transaction_id": "linkedTransactionId", "linked_transaction_line_id": "linkedTransactionLineId", }); }) ); /** @internal */ export type Rebilling$Outbound = { rebillable?: boolean | undefined; rebill_status?: string | null | undefined; linked_transaction_id?: string | null | undefined; linked_transaction_line_id?: string | null | undefined; }; /** @internal */ export const Rebilling$outboundSchema: z.ZodType< Rebilling$Outbound, z.ZodTypeDef, Rebilling > = /* @__PURE__ */ lazySchema$(() => z.object({ rebillable: z.boolean().optional(), rebillStatus: z.nullable(RebillStatus$outboundSchema).optional(), linkedTransactionId: z.nullable(z.string()).optional(), linkedTransactionLineId: z.nullable(z.string()).optional(), }).transform((v) => { return remap$(v, { rebillStatus: "rebill_status", linkedTransactionId: "linked_transaction_id", linkedTransactionLineId: "linked_transaction_line_id", }); }) ); export function rebillingToJSON(rebilling: Rebilling): string { return JSON.stringify(Rebilling$outboundSchema.parse(rebilling)); } export function rebillingFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => Rebilling$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'Rebilling' from JSON`, ); }