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';
import ViewEditPlayer from './pages/ViewEditPlayer';
import Tournaments from './pages/Tournaments';
import NewTournament from './pages/NewTournament';
import Administration from './pages/Administration/Administration';

function App() {
  
  return (
    <AuthProvider>
      <Router>
        <Navigation /> {/* Immer sichtbar */}
        <Routes>
          <Route path="/" element={<Dashboard />} /> {/* Öffentlich */}
          <Route path="/login" element={<LoginPage />} />
          <Route path="tournaments" element={<Tournaments />} />
          {/* Geschützte Routen */}
          <Route path="/players" element={<ProtectedRoute><Players /></ProtectedRoute>} />
          <Route path="/players/:id" element={<ViewEditPlayer />} />

          <Route path="/teams" element={<ProtectedRoute><TeamManagement /></ProtectedRoute>} />
          <Route path="/Administration" element={<ProtectedRoute><Administration /></ProtectedRoute>} />

          <Route path="/tournament/:id" element={<ProtectedRoute><TournamentDetails /></ProtectedRoute>} />
          <Route path="/tournament/new" element={<ProtectedRoute><NewTournament /></ProtectedRoute>} />

        </Routes>
      </Router>
    </AuthProvider>
  );
}

export default App;
