"use client";

import { useAdminAuth } from "../../hooks/useAdminAuth";

interface RequireRoleProps {
  role: "super_admin";
  fallback?: React.ReactNode;
  children: React.ReactNode;
}

export function RequireRole({ role, fallback = null, children }: RequireRoleProps) {
  const auth = useAdminAuth();
  if (auth.status !== "authorized") return null;
  if (auth.role !== role) return <>{fallback}</>;
  return <>{children}</>;
}
