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';

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="*" element={<Navigate to="/" replace />} />
          </Routes>
        </BrowserRouter>
      </ReaderProvider>
    </MangaProvider>
  );
}

export default App;