/* * 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 * as openEnums from "../../types/enums.js"; import { OpenEnum } from "../../types/enums.js"; /** * The cadence unit for the subscription plan. */ export const Interval = { Day: "DAY", Week: "WEEK", Month: "MONTH", Year: "YEAR", } as const; /** * The cadence unit for the subscription plan. */ export type Interval = OpenEnum; export type KlarnaSubscriptionOptions = { /** * The name of the subscription product. The recommended format includes a subscription id and double curly brackets. */ name: string; /** * The cadence unit for the subscription plan. */ interval: Interval; /** * The number corresponding to the interval unit. */ intervalCount: number; /** * Reference to a SKU in the transaction's cart items to link subscription to. */ reference: string; }; /** @internal */ export const Interval$outboundSchema: z.ZodType< string, z.ZodTypeDef, Interval > = openEnums.outboundSchema(Interval); /** @internal */ export type KlarnaSubscriptionOptions$Outbound = { name: string; interval: string; interval_count: number; reference: string; }; /** @internal */ export const KlarnaSubscriptionOptions$outboundSchema: z.ZodType< KlarnaSubscriptionOptions$Outbound, z.ZodTypeDef, KlarnaSubscriptionOptions > = z.object({ name: z.string(), interval: Interval$outboundSchema, intervalCount: z.number().int(), reference: z.string(), }).transform((v) => { return remap$(v, { intervalCount: "interval_count", }); }); export function klarnaSubscriptionOptionsToJSON( klarnaSubscriptionOptions: KlarnaSubscriptionOptions, ): string { return JSON.stringify( KlarnaSubscriptionOptions$outboundSchema.parse(klarnaSubscriptionOptions), ); }