"use client";
import { useMemo } from "react";
import { getGrantableRoles, hasGrantableRoles } from "@stigmer/sdk";
/**
 * Returns the list of IAM roles that can be granted on the given
 * resource kind.
 *
 * This is a local read — no network call. The data comes from the
 * `grantable_roles` field in each `ApiResourceKind`'s proto metadata,
 * generated at build time.
 *
 * @param kind - The resource kind to query, or `null` while loading.
 *
 * @example
 * ```tsx
 * const { roles, hasRoles } = useGrantableRoles(ApiResourceKind.agent);
 * // roles = [IamRole.owner, IamRole.viewer]
 * // hasRoles = true
 * ```
 */
export function useGrantableRoles(kind) {
    return useMemo(() => {
        if (kind === null) {
            return { roles: [], hasRoles: false };
        }
        return {
            roles: getGrantableRoles(kind),
            hasRoles: hasGrantableRoles(kind),
        };
    }, [kind]);
}
//# sourceMappingURL=useGrantableRoles.js.map