import { Routes, Route, Navigate } from 'react-router-dom';
import { AppShell } from './components/layout/AppShell';
import { LoginPage, RequireAuth } from './lib/auth';
import { DashboardPage } from './pages/DashboardPage';
import { CampaignsPage } from './pages/CampaignsPage';
import { CampaignWizardPage } from './pages/CampaignWizardPage';
import { CampaignDetailPage } from './pages/CampaignDetailPage';
import { MailboxesPage } from './pages/MailboxesPage';
import { MailboxDetailPage } from './pages/MailboxDetailPage';
import { ActivityPage } from './pages/ActivityPage';
import { SettingsPage } from './pages/SettingsPage';

export default function App() {
  return (
    <Routes>
      <Route path="/login" element={<LoginPage />} />
      <Route
        element={
          <RequireAuth>
            <AppShell />
          </RequireAuth>
        }
      >
        <Route index element={<DashboardPage />} />
        <Route path="campaigns" element={<CampaignsPage />} />
        <Route path="campaigns/new" element={<CampaignWizardPage />} />
        <Route path="campaigns/:id" element={<CampaignDetailPage />} />
        <Route path="mailboxes" element={<MailboxesPage />} />
        <Route path="mailboxes/:id" element={<MailboxDetailPage />} />
        <Route path="activity" element={<ActivityPage />} />
        <Route path="settings" element={<SettingsPage />} />
      </Route>
      <Route path="*" element={<Navigate to="/" replace />} />
    </Routes>
  );
}
