import { Routes, Route, Navigate } from 'react-router-dom';
import { MainLayout } from './shared/components/MainLayout';
import { ProtectedRoute } from './shared/components/ProtectedRoute';
import { LoginPage } from './features/auth/presentation/pages/LoginPage';
import { DashboardPage } from './features/dashboard/presentation/pages/DashboardPage';
import { KnowledgePage } from './features/knowledge/presentation/pages/KnowledgePage';
import { ExperiencePage } from './features/experience/presentation/pages/ExperiencePage';

function App() {
  return (
    <Routes>
      {/* 登录页 */}
      <Route path="/login" element={<LoginPage />} />

      {/* 需要认证的路由 */}
      <Route
        path="/"
        element={
          <ProtectedRoute>
            <MainLayout />
          </ProtectedRoute>
        }
      >
        <Route index element={<DashboardPage />} />
        <Route path="knowledge" element={<KnowledgePage />} />
        <Route path="experience" element={<ExperiencePage />} />
        <Route path="users" element={<div className="p-6">用户管理（开发中）</div>} />
        <Route path="settings" element={<div className="p-6">系统设置（开发中）</div>} />
      </Route>

      {/* 未匹配路由重定向 */}
      <Route path="*" element={<Navigate to="/" replace />} />
    </Routes>
  );
}

export default App;
