import { redirect } from 'next/navigation';
import { getCurrentUser } from '@/lib/auth';
import { hasPageAccess } from '@/lib/permissions';
import DashboardLayout from '@/components/DashboardLayout';
import ParametresContent from '@/components/ParametresContent';

export default async function ParametresPage() {
  const user = await getCurrentUser();

  if (!user) {
    redirect('/login');
  }

  const hasAccess = await hasPageAccess(user.id, '/dashboard/parametres');
  if (!hasAccess) {
    redirect('/login');
  }

  return (
    <DashboardLayout user={user}>
      <ParametresContent />
    </DashboardLayout>
  );
}
