import { useAuth } from 'src/contexts/JWTContext';
import { hasAnyPermissions, hasAllPermissions } from 'src/utils/permissions';

const usePermissions = (requiredPermissions: string[]) => {
  const { permissions: userPermissions } = useAuth();

  return {
    hasAny: hasAnyPermissions(userPermissions, requiredPermissions),
    hasAll: hasAllPermissions(userPermissions, requiredPermissions),
  };
};

export default usePermissions;
