import { BrowserRouter, Routes, Route } from 'react-router-dom'
import Sidebar from './components/layout/Sidebar'
import Dashboard from './pages/Dashboard'
import GeoRadar from './pages/GeoRadar'
import Markets from './pages/Markets'
import MacroRegime from './pages/MacroRegime'
import OptionsLab from './pages/OptionsLab'
import Backtest from './pages/Backtest'
import CalendarPage from './pages/CalendarPage'
import Portfolio from './pages/Portfolio'
import PatternEditor from './pages/PatternEditor'
import JournalDeBord from './pages/JournalDeBord'
import RapportIA from './pages/RapportIA'
import SuperContexte from './pages/SuperContexte'
import Config from './pages/Config'
import Analytics from './pages/Analytics'
import { useCycleWatcher } from './hooks/useApi'

function GlobalWatcher() {
  useCycleWatcher()
  return null
}

export default function App() {
  return (
    <BrowserRouter>
      <div className="flex min-h-screen">
        <GlobalWatcher />
        <Sidebar />
        <main className="flex-1 overflow-auto">
          <Routes>
            <Route path="/" element={<Dashboard />} />
            <Route path="/geo" element={<GeoRadar />} />
            <Route path="/markets" element={<Markets />} />
            <Route path="/macro" element={<MacroRegime />} />
            <Route path="/options" element={<OptionsLab />} />
            <Route path="/patterns" element={<PatternEditor />} />
            <Route path="/portfolio" element={<Portfolio />} />
            <Route path="/backtest" element={<Backtest />} />
            <Route path="/calendar" element={<CalendarPage />} />
            <Route path="/journal" element={<JournalDeBord />} />
            <Route path="/rapport" element={<RapportIA />} />
            <Route path="/super-contexte" element={<SuperContexte />} />
            <Route path="/config" element={<Config />} />
            <Route path="/analytics" element={<Analytics />} />
          </Routes>
        </main>
      </div>
    </BrowserRouter>
  )
}
