/* * 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 { CustomerCancellationReason, CustomerCancellationReason$outboundSchema, } from "./customercancellationreason.js"; export type CustomerSubscriptionCancel = { /** * Cancel an active subscription once the current period ends. * * @remarks * * Or uncancel a subscription currently set to be revoked at period end. */ cancelAtPeriodEnd?: boolean | null | undefined; /** * Customers reason for cancellation. * * @remarks * * * `too_expensive`: Too expensive for the customer. * * `missing_features`: Customer is missing certain features. * * `switched_service`: Customer switched to another service. * * `unused`: Customer is not using it enough. * * `customer_service`: Customer is not satisfied with the customer service. * * `low_quality`: Customer is unhappy with the quality. * * `too_complex`: Customer considers the service too complicated. * * `other`: Other reason(s). */ cancellationReason?: CustomerCancellationReason | null | undefined; /** * Customer feedback and why they decided to cancel. */ cancellationComment?: string | null | undefined; }; /** @internal */ export type CustomerSubscriptionCancel$Outbound = { cancel_at_period_end?: boolean | null | undefined; cancellation_reason?: string | null | undefined; cancellation_comment?: string | null | undefined; }; /** @internal */ export const CustomerSubscriptionCancel$outboundSchema: z.ZodMiniType< CustomerSubscriptionCancel$Outbound, CustomerSubscriptionCancel > = z.pipe( z.object({ cancelAtPeriodEnd: z.optional(z.nullable(z.boolean())), cancellationReason: z.optional( z.nullable(CustomerCancellationReason$outboundSchema), ), cancellationComment: z.optional(z.nullable(z.string())), }), z.transform((v) => { return remap$(v, { cancelAtPeriodEnd: "cancel_at_period_end", cancellationReason: "cancellation_reason", cancellationComment: "cancellation_comment", }); }), ); export function customerSubscriptionCancelToJSON( customerSubscriptionCancel: CustomerSubscriptionCancel, ): string { return JSON.stringify( CustomerSubscriptionCancel$outboundSchema.parse(customerSubscriptionCancel), ); }