/*
 * 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 { safeParse } from "../../lib/schemas.js";
import { Result as SafeParseResult } from "../../types/fp.js";
import { SDKValidationError } from "../errors/sdkvalidationerror.js";

export type BenefitGrantLicenseKeysProperties = {
  userProvidedKey?: string | undefined;
  licenseKeyId?: string | undefined;
  displayKey?: string | undefined;
};

/** @internal */
export const BenefitGrantLicenseKeysProperties$inboundSchema: z.ZodMiniType<
  BenefitGrantLicenseKeysProperties,
  unknown
> = z.pipe(
  z.object({
    user_provided_key: z.optional(z.string()),
    license_key_id: z.optional(z.string()),
    display_key: z.optional(z.string()),
  }),
  z.transform((v) => {
    return remap$(v, {
      "user_provided_key": "userProvidedKey",
      "license_key_id": "licenseKeyId",
      "display_key": "displayKey",
    });
  }),
);
/** @internal */
export type BenefitGrantLicenseKeysProperties$Outbound = {
  user_provided_key?: string | undefined;
  license_key_id?: string | undefined;
  display_key?: string | undefined;
};

/** @internal */
export const BenefitGrantLicenseKeysProperties$outboundSchema: z.ZodMiniType<
  BenefitGrantLicenseKeysProperties$Outbound,
  BenefitGrantLicenseKeysProperties
> = z.pipe(
  z.object({
    userProvidedKey: z.optional(z.string()),
    licenseKeyId: z.optional(z.string()),
    displayKey: z.optional(z.string()),
  }),
  z.transform((v) => {
    return remap$(v, {
      userProvidedKey: "user_provided_key",
      licenseKeyId: "license_key_id",
      displayKey: "display_key",
    });
  }),
);

export function benefitGrantLicenseKeysPropertiesToJSON(
  benefitGrantLicenseKeysProperties: BenefitGrantLicenseKeysProperties,
): string {
  return JSON.stringify(
    BenefitGrantLicenseKeysProperties$outboundSchema.parse(
      benefitGrantLicenseKeysProperties,
    ),
  );
}
export function benefitGrantLicenseKeysPropertiesFromJSON(
  jsonString: string,
): SafeParseResult<BenefitGrantLicenseKeysProperties, SDKValidationError> {
  return safeParse(
    jsonString,
    (x) => BenefitGrantLicenseKeysProperties$inboundSchema.parse(JSON.parse(x)),
    `Failed to parse 'BenefitGrantLicenseKeysProperties' from JSON`,
  );
}
