/* * 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 { CouponCadence, CouponCadence$outboundSchema, } from "./coupon-cadence.js"; import { CouponType, CouponType$outboundSchema } from "./coupon-type.js"; export type CreateCouponRequest = { amountOff?: string | undefined; cadence: CouponCadence; couponCode?: string | undefined; currency?: string | undefined; durationInPeriods?: number | undefined; maxRedemptions?: number | undefined; metadata?: { [k: string]: string } | undefined; name: string; percentageOff?: string | undefined; redeemAfter?: string | undefined; redeemBefore?: string | undefined; rules?: { [k: string]: any } | undefined; type: CouponType; }; /** @internal */ export type CreateCouponRequest$Outbound = { amount_off?: string | undefined; cadence: string; coupon_code?: string | undefined; currency?: string | undefined; duration_in_periods?: number | undefined; max_redemptions?: number | undefined; metadata?: { [k: string]: string } | undefined; name: string; percentage_off?: string | undefined; redeem_after?: string | undefined; redeem_before?: string | undefined; rules?: { [k: string]: any } | undefined; type: string; }; /** @internal */ export const CreateCouponRequest$outboundSchema: z.ZodMiniType< CreateCouponRequest$Outbound, CreateCouponRequest > = z.pipe( z.object({ amountOff: z.optional(z.string()), cadence: CouponCadence$outboundSchema, couponCode: z.optional(z.string()), currency: z.optional(z.string()), durationInPeriods: z.optional(z.int()), maxRedemptions: z.optional(z.int()), metadata: z.optional(z.record(z.string(), z.string())), name: z.string(), percentageOff: z.optional(z.string()), redeemAfter: z.optional(z.string()), redeemBefore: z.optional(z.string()), rules: z.optional(z.record(z.string(), z.any())), type: CouponType$outboundSchema, }), z.transform((v) => { return remap$(v, { amountOff: "amount_off", couponCode: "coupon_code", durationInPeriods: "duration_in_periods", maxRedemptions: "max_redemptions", percentageOff: "percentage_off", redeemAfter: "redeem_after", redeemBefore: "redeem_before", }); }), ); export function createCouponRequestToJSON( createCouponRequest: CreateCouponRequest, ): string { return JSON.stringify( CreateCouponRequest$outboundSchema.parse(createCouponRequest), ); }