/*
 * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
 */

import * as z from "zod/v4-mini";
import { smartUnion } from "../../types/smartUnion.js";
import {
  CustomerSubscriptionCancel,
  CustomerSubscriptionCancel$Outbound,
  CustomerSubscriptionCancel$outboundSchema,
} from "./customersubscriptioncancel.js";
import {
  CustomerSubscriptionPause,
  CustomerSubscriptionPause$Outbound,
  CustomerSubscriptionPause$outboundSchema,
} from "./customersubscriptionpause.js";
import {
  CustomerSubscriptionResume,
  CustomerSubscriptionResume$Outbound,
  CustomerSubscriptionResume$outboundSchema,
} from "./customersubscriptionresume.js";
import {
  CustomerSubscriptionUpdateClear,
  CustomerSubscriptionUpdateClear$Outbound,
  CustomerSubscriptionUpdateClear$outboundSchema,
} from "./customersubscriptionupdateclear.js";
import {
  CustomerSubscriptionUpdateProduct,
  CustomerSubscriptionUpdateProduct$Outbound,
  CustomerSubscriptionUpdateProduct$outboundSchema,
} from "./customersubscriptionupdateproduct.js";
import {
  CustomerSubscriptionUpdateSeats,
  CustomerSubscriptionUpdateSeats$Outbound,
  CustomerSubscriptionUpdateSeats$outboundSchema,
} from "./customersubscriptionupdateseats.js";

export type CustomerSubscriptionUpdate =
  | CustomerSubscriptionUpdateProduct
  | CustomerSubscriptionUpdateSeats
  | CustomerSubscriptionPause
  | CustomerSubscriptionResume
  | CustomerSubscriptionUpdateClear
  | CustomerSubscriptionCancel;

/** @internal */
export type CustomerSubscriptionUpdate$Outbound =
  | CustomerSubscriptionUpdateProduct$Outbound
  | CustomerSubscriptionUpdateSeats$Outbound
  | CustomerSubscriptionPause$Outbound
  | CustomerSubscriptionResume$Outbound
  | CustomerSubscriptionUpdateClear$Outbound
  | CustomerSubscriptionCancel$Outbound;

/** @internal */
export const CustomerSubscriptionUpdate$outboundSchema: z.ZodMiniType<
  CustomerSubscriptionUpdate$Outbound,
  CustomerSubscriptionUpdate
> = smartUnion([
  CustomerSubscriptionUpdateProduct$outboundSchema,
  CustomerSubscriptionUpdateSeats$outboundSchema,
  CustomerSubscriptionPause$outboundSchema,
  CustomerSubscriptionResume$outboundSchema,
  CustomerSubscriptionUpdateClear$outboundSchema,
  CustomerSubscriptionCancel$outboundSchema,
]);

export function customerSubscriptionUpdateToJSON(
  customerSubscriptionUpdate: CustomerSubscriptionUpdate,
): string {
  return JSON.stringify(
    CustomerSubscriptionUpdate$outboundSchema.parse(customerSubscriptionUpdate),
  );
}
