import React from 'react';
import { BrowserRouter, Routes, Route, Navigate } from 'react-router-dom';
import { HomePage } from './presentation/pages/HomePage.jsx';
import { MangaDetailPage } from './presentation/pages/MangaDetailPage.jsx';
import { AddMangaPage } from './presentation/pages/AddMangaPage.jsx';
import { ReaderPage } from './presentation/pages/ReaderPage.jsx';
import { MangaProvider } from './presentation/context/MangaContext.jsx';
import { ReaderProvider } from './presentation/context/ReaderContext.jsx';

// Placeholder components for new routes
const PlaceholderPage = ({ title }) => (
  <div className="container mx-auto px-4 py-8">
    <h1 className="text-2xl font-bold mb-4">{title}</h1>
    <p className="text-gray-600">Cette fonctionnalité sera bientôt disponible.</p>
  </div>
);

function App() {
  return (
    <MangaProvider>
      <ReaderProvider>
        <BrowserRouter>
          <Routes>
            <Route path="/" element={<HomePage />} />
            <Route path="/manga/:slug" element={<MangaDetailPage />} />
            <Route path="/add" element={<AddMangaPage />} />
            <Route path="/reader/:chapterId" element={<ReaderPage />} />
            
            <Route path="/import" element={<PlaceholderPage title="Import de bibliothèque" />} />
            <Route path="/discover" element={<PlaceholderPage title="Découvrir" />} />
            <Route path="/convert" element={<PlaceholderPage title="Convertir CBR en CBZ" />} />
            <Route path="/calendar" element={<PlaceholderPage title="Calendrier" />} />
            <Route path="/activity" element={<PlaceholderPage title="Activité" />} />
            
            <Route path="/settings/general" element={<PlaceholderPage title="Paramètres généraux" />} />
            <Route path="/settings/folders" element={<PlaceholderPage title="Gestion des dossiers" />} />
            <Route path="/settings/scrappers" element={<PlaceholderPage title="Configuration des scrappers" />} />
            <Route path="/settings/ui" element={<PlaceholderPage title="Paramètres de l'interface" />} />
            
            <Route path="/system/status" element={<PlaceholderPage title="Status du système" />} />
            <Route path="/system/backup" element={<PlaceholderPage title="Sauvegarde" />} />
            <Route path="/system/logs" element={<PlaceholderPage title="Journaux système" />} />
            <Route path="/system/updates" element={<PlaceholderPage title="Mises à jour" />} />
            
            <Route path="*" element={<Navigate to="/" replace />} />
          </Routes>
        </BrowserRouter>
      </ReaderProvider>
    </MangaProvider>
  );
}

export default App;