
import { getServerSession } from 'next-auth';
import { redirect } from 'next/navigation';
import { authOptions } from '@/lib/auth';
import { CustomerDashboardClient } from '@/components/customer/customer-dashboard-client';

export const dynamic = 'force-dynamic';

export default async function CustomerDashboardPage() {
  const session = await getServerSession(authOptions);

  if (!session) {
    redirect('/auth/signin');
  }

  // Only customers can access this page
  if (session.user.role !== 'CUSTOMER') {
    redirect('/dashboard');
  }

  return <CustomerDashboardClient />;
}
