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 PatternExplorer from './pages/PatternExplorer'
import PatternLab from './pages/PatternLab'
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 AnalyticsAdvanced from './pages/AnalyticsAdvanced'
import RiskDashboard from './pages/RiskDashboard'
import SystemLogs from './pages/SystemLogs'
import VaRAnalysis from './pages/VaRAnalysis'
import PositionHistory from './pages/PositionHistory'
import InstitutionalReports from './pages/InstitutionalReports'
import SpecialistDesks from './pages/SpecialistDesks'
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={<PatternExplorer />} />
            <Route path="/patterns/edit" element={<PatternEditor />} />
            <Route path="/pattern-lab" element={<PatternLab />} />
            <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 />} />
            <Route path="/analytics-advanced" element={<AnalyticsAdvanced />} />
            <Route path="/risk" element={<RiskDashboard />} />
            <Route path="/var" element={<VaRAnalysis />} />
            <Route path="/position-history" element={<PositionHistory />} />
            <Route path="/logs" element={<SystemLogs />} />
            <Route path="/institutional" element={<InstitutionalReports />} />
            <Route path="/specialist-desks" element={<SpecialistDesks />} />
          </Routes>
        </main>
      </div>
    </BrowserRouter>
  )
}
