import { Routes, Route, Navigate } from 'react-router-dom';
import ProtectedRoute from './components/auth/ProtectedRoute';
import AppShell from './components/layout/AppShell';
import LoginPage from './pages/LoginPage';
import RegisterPage from './pages/RegisterPage';
import WatchlistPage from './pages/WatchlistPage';
import TickerDetailPage from './pages/TickerDetailPage';
import ScannerPage from './pages/ScannerPage';
import RankingsPage from './pages/RankingsPage';
import PerformancePage from './pages/PerformancePage';
import AdminPage from './pages/AdminPage';

export default function App() {
  return (
    <Routes>
      <Route path="/login" element={<LoginPage />} />
      <Route path="/register" element={<RegisterPage />} />
      <Route element={<ProtectedRoute />}>
        <Route element={<AppShell />}>
          <Route path="/" element={<Navigate to="/watchlist" />} />
          <Route path="/watchlist" element={<WatchlistPage />} />
          <Route path="/ticker/:symbol" element={<TickerDetailPage />} />
          <Route path="/scanner" element={<ScannerPage />} />
          <Route path="/rankings" element={<RankingsPage />} />
          <Route path="/performance" element={<PerformancePage />} />
          <Route element={<ProtectedRoute requireAdmin />}>
            <Route path="/admin" element={<AdminPage />} />
          </Route>
        </Route>
      </Route>
    </Routes>
  );
}
