export default defineNuxtRouteMiddleware((to, from) => {
  const { isAuthenticated, isUser, isBoard, isAdmin } = useAuth();
  
  if (!isAuthenticated.value) {
    return navigateTo('/login');
  }
  
  // Members, board members, and admins can all access member pages
  if (!isUser.value && !isBoard.value && !isAdmin.value) {
    throw createError({
      statusCode: 403,
      statusMessage: 'Access denied. Member privileges required.'
    });
  }
});