// middleware/admin.ts
export default defineNuxtRouteMiddleware((to, from) => {
  const { isAuthenticated, isAdmin } = useAuth();
  
  // Check if user is authenticated
  if (!isAuthenticated.value) {
    return navigateTo('/login');
  }
  
  // Check if user has admin privileges
  if (!isAdmin.value) {
    throw createError({
      statusCode: 403,
      statusMessage: 'Access denied. Administrator privileges required.'
    });
  }
});