/*
 * 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 V2PermissionsCreateRoleResponseData = {
  /**
   * The unique identifier assigned to the newly created role.
   *
   * @remarks
   * Use this ID to reference the role in permission assignments, key operations, and role management calls.
   * Always begins with 'role_' followed by a unique alphanumeric sequence.
   * Store this ID if you need to manage, modify, or assign this role in future operations.
   */
  roleId: string;
};

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

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