import { NextResponse } from 'next/server';

export function middleware(request) {
  const isLoggedIn = request.cookies.get('appwrite-session'); // Set manually if needed
  const url = request.nextUrl;

  if (!isLoggedIn && url.pathname.startsWith('/pages')) {
    return NextResponse.redirect(new URL('/login', request.url));
  }

  return NextResponse.next();
}

export const config = {
  matcher: ['/pages/:path*'],
};
