import { createBrowserRouter, type RouterProviderProps } from 'react-router-dom';
import { ProtectedRoute } from './components/Layout/ProtectedRoute';
import { AppShell } from './components/Layout/AppShell';
import { LoginPage } from './pages/LoginPage';
import { DashboardPage } from './pages/DashboardPage';
import { ArchivePage } from './pages/ArchivePage';
import { CompletedPage } from './pages/CompletedPage';
import { TrashPage } from './pages/TrashPage';
import { ProfileSettingsPage } from './pages/ProfileSettingsPage';
import { PublicProfilePage } from './pages/PublicProfilePage';
import { NotFoundPage } from './pages/NotFoundPage';

export const router: RouterProviderProps['router'] = createBrowserRouter([
  { path: '/login', element: <LoginPage /> },
  { path: '/u/:slug', element: <PublicProfilePage /> },
  {
    element: (
      <ProtectedRoute>
        <AppShell />
      </ProtectedRoute>
    ),
    children: [
      { path: '/', element: <DashboardPage /> },
      { path: '/archive', element: <ArchivePage /> },
      { path: '/completed', element: <CompletedPage /> },
      { path: '/trash', element: <TrashPage /> },
      { path: '/settings', element: <ProfileSettingsPage /> },
    ],
  },
  { path: '*', element: <NotFoundPage /> },
]);
