import { createBrowserRouter, Navigate } from 'react-router-dom';
import { DoctorLayout } from '../components/layout/DoctorLayout';
import { AuthGuard } from './AuthGuard';
import { LoginPage } from '../pages/auth/LoginPage';
import { DashboardPage } from '../pages/dashboard/DashboardPage';
import { PatientListPage } from '../pages/patients/PatientListPage';
import { PatientDetailPage } from '../pages/patients/PatientDetailPage';
import { ConsultationListPage } from '../pages/consultations/ConsultationListPage';
import { ChatPage } from '../pages/consultations/ChatPage';
import { ReportListPage } from '../pages/reports/ReportListPage';
import { ReportDetailPage } from '../pages/reports/ReportDetailPage';
import { FollowUpListPage } from '../pages/followups/FollowUpListPage';
import { FollowUpEditPage } from '../pages/followups/FollowUpEditPage';
import { ProfilePage } from '../pages/settings/ProfilePage';

export const router = createBrowserRouter([
  {
    path: '/login',
    element: <LoginPage />,
  },
  {
    element: (
      <AuthGuard>
        <DoctorLayout />
      </AuthGuard>
    ),
    children: [
      { index: true, element: <Navigate to="/dashboard" replace /> },
      { path: 'dashboard', element: <DashboardPage /> },
      { path: 'patients', element: <PatientListPage /> },
      { path: 'patients/:id', element: <PatientDetailPage /> },
      { path: 'consultations', element: <ConsultationListPage /> },
      { path: 'consultations/:id', element: <ChatPage /> },
      { path: 'reports', element: <ReportListPage /> },
      { path: 'reports/:id', element: <ReportDetailPage /> },
      { path: 'follow-ups', element: <FollowUpListPage /> },
      { path: 'follow-ups/:id/edit', element: <FollowUpEditPage /> },
      { path: 'profile', element: <ProfilePage /> },
    ],
  },
]);
