import { StrictMode } from 'react'
import { createRoot } from 'react-dom/client'
import { BrowserRouter as Router, Routes, Route } from 'react-router-dom'
import './index.css'
import './i18n'
import { ThemeProvider } from './contexts/ThemeContext'
import { AuthProvider } from './contexts/AuthContext'
import { ServerProvider } from './contexts/ServerContext'
import { StatsProvider } from './contexts/StatsContext'
import ScrollToTop from './components/ScrollToTop'
import App from './App.tsx'
import Friends from './pages/Friends.tsx'
import Blog from './pages/Blog.tsx'
import Servers from './pages/Servers.tsx'
import Forum from './pages/Forum.tsx'
import AuthCallback from './pages/AuthCallback.tsx'

createRoot(document.getElementById('root')!).render(
  <StrictMode>
    <ThemeProvider>
      <AuthProvider>
        <StatsProvider>
          <ServerProvider>
            <Router>
              <ScrollToTop />
              <Routes>
                <Route path="/" element={<App />} />
                <Route path="/friends" element={<Friends />} />
                <Route path="/blog" element={<Blog />} />
                <Route path="/servers" element={<Servers />} />
                <Route path="/forum" element={<Forum />} />
                <Route path="/auth/callback" element={<AuthCallback />} />
              </Routes>
            </Router>
          </ServerProvider>
        </StatsProvider>
      </AuthProvider>
    </ThemeProvider>
  </StrictMode>,
)
