import type { ReactNode } from 'react';
import { usePermission } from '../hooks/usePermission';

interface AuthGuardProps {
  code: string;
  children: ReactNode;
}

export function AuthGuard({ code, children }: AuthGuardProps) {
  const { hasPermission } = usePermission(code);
  if (!hasPermission) return null;
  return <>{children}</>;
}
