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

import * as z from "zod/v3";

export type V2KeysDeleteKeyRequestBody = {
  /**
   * Specifies which key to delete using the database identifier returned from `createKey`.
   *
   * @remarks
   * Do not confuse this with the actual API key string that users include in requests.
   * Deletion immediately invalidates the key, causing all future verification attempts to fail with `code=NOT_FOUND`.
   * Key deletion triggers cache invalidation across all regions but may take up to 30 seconds to fully propagate.
   */
  keyId: string;
  /**
   * Controls deletion behavior between recoverable soft-deletion and irreversible permanent erasure.
   *
   * @remarks
   * Soft deletion (default) preserves key data for potential recovery through direct database operations.
   * Permanent deletion completely removes all traces including hash values and metadata with no recovery option.
   *
   * Use permanent deletion only for regulatory compliance (GDPR), resolving hash collisions, or when reusing identical key strings.
   * Permanent deletion cannot be undone and may affect analytics data that references the deleted key.
   * Most applications should use soft deletion to maintain audit trails and prevent accidental data loss.
   */
  permanent?: boolean | undefined;
};

/** @internal */
export type V2KeysDeleteKeyRequestBody$Outbound = {
  keyId: string;
  permanent: boolean;
};

/** @internal */
export const V2KeysDeleteKeyRequestBody$outboundSchema: z.ZodType<
  V2KeysDeleteKeyRequestBody$Outbound,
  z.ZodTypeDef,
  V2KeysDeleteKeyRequestBody
> = z.object({
  keyId: z.string(),
  permanent: z.boolean().default(false),
});

export function v2KeysDeleteKeyRequestBodyToJSON(
  v2KeysDeleteKeyRequestBody: V2KeysDeleteKeyRequestBody,
): string {
  return JSON.stringify(
    V2KeysDeleteKeyRequestBody$outboundSchema.parse(v2KeysDeleteKeyRequestBody),
  );
}
