import { BrowserRouter, Route, Routes } from 'react-router';
import { AuthProvider } from './auth/AuthProvider';
import { ProtectedRoute } from './auth/ProtectedRoute';
import { AdminRoute } from './auth/AdminRoute';
import { AppLayout } from './components/layout/AppLayout';
import { LoginPage } from './pages/LoginPage';
import { PendingPage } from './pages/PendingPage';
import { DeniedPage } from './pages/DeniedPage';
import { HomePage } from './pages/HomePage';
import { GuidePage } from './pages/GuidePage';

function App() {
  return (
    <AuthProvider>
      <BrowserRouter>
        <Routes>
          {/* Public */}
          <Route path="/login" element={<LoginPage />} />
          <Route path="/pending" element={<PendingPage />} />
          <Route path="/denied" element={<DeniedPage />} />

          {/* Protected */}
          <Route element={<ProtectedRoute />}>
            <Route element={<AppLayout />}>
              <Route index element={<HomePage />} />
              <Route path="/dev/:section" element={<GuidePage />} />

              {/* Admin */}
              <Route element={<AdminRoute />}>
                <Route path="/admin/users" element={<div className="p-8"><h1 className="text-2xl font-bold">사용자 관리</h1><p className="text-gray-500 mt-2">준비 중</p></div>} />
                <Route path="/admin/roles" element={<div className="p-8"><h1 className="text-2xl font-bold">롤 관리</h1><p className="text-gray-500 mt-2">준비 중</p></div>} />
                <Route path="/admin/permissions" element={<div className="p-8"><h1 className="text-2xl font-bold">권한 관리</h1><p className="text-gray-500 mt-2">준비 중</p></div>} />
                <Route path="/admin/stats" element={<div className="p-8"><h1 className="text-2xl font-bold">통계</h1><p className="text-gray-500 mt-2">준비 중</p></div>} />
              </Route>
            </Route>
          </Route>
        </Routes>
      </BrowserRouter>
    </AuthProvider>
  );
}

export default App;
