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

import * as z from "zod/v3";
import { safeParse } from "../../lib/schemas.js";
import { Result as SafeParseResult } from "../../types/fp.js";
import { SDKValidationError } from "../errors/sdkvalidationerror.js";

export type V2PermissionsCreatePermissionResponseData = {
  /**
   * The unique identifier assigned to the newly created permission.
   *
   * @remarks
   * Use this ID to reference the permission in role assignments, key operations, and other API calls.
   * Always begins with 'perm_' followed by a unique alphanumeric sequence.
   * Store this ID if you need to manage or reference this permission in future operations.
   */
  permissionId: string;
};

/** @internal */
export const V2PermissionsCreatePermissionResponseData$inboundSchema: z.ZodType<
  V2PermissionsCreatePermissionResponseData,
  z.ZodTypeDef,
  unknown
> = z.object({
  permissionId: z.string(),
});

export function v2PermissionsCreatePermissionResponseDataFromJSON(
  jsonString: string,
): SafeParseResult<
  V2PermissionsCreatePermissionResponseData,
  SDKValidationError
> {
  return safeParse(
    jsonString,
    (x) =>
      V2PermissionsCreatePermissionResponseData$inboundSchema.parse(
        JSON.parse(x),
      ),
    `Failed to parse 'V2PermissionsCreatePermissionResponseData' from JSON`,
  );
}
