import { BrowserRouter as Router, Routes, Route } from 'react-router-dom';
import { AuthProvider } from './pages/AuthContext';
import ProtectedRoute from './pages/ProtectedRoute';
import LoginPage from './pages/LoginPage';
import Dashboard from './pages/Dashboard';
import TournamentDetails from './pages/TournamentDetails';
import Players from './pages/Players';
import Navigation from './pages/Navigation';
import TeamManagement from './pages/Teams';

function App() {
  
  return (
    <AuthProvider>
      <Router>
        <Navigation /> {/* Immer sichtbar */}
        <Routes>
          <Route path="/" element={<Dashboard />} /> {/* Öffentlich */}
          <Route path="/login" element={<LoginPage />} />

          {/* Geschützte Routen */}
          <Route path="/players" element={<ProtectedRoute><Players /></ProtectedRoute>} />
          <Route path="/teams" element={<ProtectedRoute><TeamManagement /></ProtectedRoute>} />

          <Route path="/tournaments/:id" element={<ProtectedRoute><TournamentDetails /></ProtectedRoute>} />
        </Routes>
      </Router>
    </AuthProvider>
  );
}

export default App;
