import { useAuth } from "@/app/auth/AuthProvider.jsx";
import { PERMISSIONS } from "@/app/permissions";

export function useRoleAbilities() {
  const { can } = useAuth();
  const canGrant = can(PERMISSIONS.rolePermission) || can(PERMISSIONS.roleManage);

  return {
    canCreate: can(PERMISSIONS.roleCreate) || can(PERMISSIONS.roleManage),
    canDelete: can(PERMISSIONS.roleDelete) || can(PERMISSIONS.roleManage),
    canGrant,
    canLoadPermissions: can(PERMISSIONS.permissionView) || canGrant,
    canUpdate: can(PERMISSIONS.roleUpdate) || can(PERMISSIONS.roleManage)
  };
}
