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

import * as z from "zod/v3";

export type V2KeysRemovePermissionsRequestBody = {
  /**
   * Specifies which key to remove permissions from using the database identifier returned from `keys.createKey`.
   *
   * @remarks
   * Do not confuse this with the actual API key string that users include in requests.
   */
  keyId: string;
  /**
   * Removes direct permissions from the key without affecting role-based permissions.
   *
   * @remarks
   *
   * You can either use a permission slug, or the permission ID.
   *
   * After removal, verification checks for these permissions will fail unless granted through roles.
   */
  permissions: Array<string>;
};

/** @internal */
export type V2KeysRemovePermissionsRequestBody$Outbound = {
  keyId: string;
  permissions: Array<string>;
};

/** @internal */
export const V2KeysRemovePermissionsRequestBody$outboundSchema: z.ZodType<
  V2KeysRemovePermissionsRequestBody$Outbound,
  z.ZodTypeDef,
  V2KeysRemovePermissionsRequestBody
> = z.object({
  keyId: z.string(),
  permissions: z.array(z.string()),
});

export function v2KeysRemovePermissionsRequestBodyToJSON(
  v2KeysRemovePermissionsRequestBody: V2KeysRemovePermissionsRequestBody,
): string {
  return JSON.stringify(
    V2KeysRemovePermissionsRequestBody$outboundSchema.parse(
      v2KeysRemovePermissionsRequestBody,
    ),
  );
}
