/*
 * 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 {
  BenefitLicenseKeyActivationCreateProperties,
  BenefitLicenseKeyActivationCreateProperties$Outbound,
  BenefitLicenseKeyActivationCreateProperties$outboundSchema,
} from "./benefitlicensekeyactivationcreateproperties.js";
import {
  BenefitLicenseKeyExpirationProperties,
  BenefitLicenseKeyExpirationProperties$Outbound,
  BenefitLicenseKeyExpirationProperties$outboundSchema,
} from "./benefitlicensekeyexpirationproperties.js";

export type BenefitLicenseKeysCreateProperties = {
  prefix?: string | null | undefined;
  expires?: BenefitLicenseKeyExpirationProperties | null | undefined;
  activations?: BenefitLicenseKeyActivationCreateProperties | null | undefined;
  limitUsage?: number | null | undefined;
};

/** @internal */
export type BenefitLicenseKeysCreateProperties$Outbound = {
  prefix?: string | null | undefined;
  expires?: BenefitLicenseKeyExpirationProperties$Outbound | null | undefined;
  activations?:
    | BenefitLicenseKeyActivationCreateProperties$Outbound
    | null
    | undefined;
  limit_usage?: number | null | undefined;
};

/** @internal */
export const BenefitLicenseKeysCreateProperties$outboundSchema: z.ZodMiniType<
  BenefitLicenseKeysCreateProperties$Outbound,
  BenefitLicenseKeysCreateProperties
> = z.pipe(
  z.object({
    prefix: z.optional(z.nullable(z.string())),
    expires: z.optional(
      z.nullable(BenefitLicenseKeyExpirationProperties$outboundSchema),
    ),
    activations: z.optional(
      z.nullable(BenefitLicenseKeyActivationCreateProperties$outboundSchema),
    ),
    limitUsage: z.optional(z.nullable(z.int())),
  }),
  z.transform((v) => {
    return remap$(v, {
      limitUsage: "limit_usage",
    });
  }),
);

export function benefitLicenseKeysCreatePropertiesToJSON(
  benefitLicenseKeysCreateProperties: BenefitLicenseKeysCreateProperties,
): string {
  return JSON.stringify(
    BenefitLicenseKeysCreateProperties$outboundSchema.parse(
      benefitLicenseKeysCreateProperties,
    ),
  );
}
