import { useAuth } from '../../contexts/AuthContext';

interface PermissionWrapperProps {
    permission: number;
    children: any;
    fallback?: any;
}

export const PermissionWrapper = ({
    permission,
    children,
    fallback = null
}: PermissionWrapperProps) => {
    const { hasPermission } = useAuth();

    if (!hasPermission(permission)) {
        return fallback;
    }

    return children;
}; 