import React from 'react';
import { BrowserRouter as Router, Routes, Route, Navigate } from 'react-router-dom';
import Layout from '../components/Layout';
import DashboardPage from '../pages/DashboardPage';
import ProductPage from '../pages/ProductPage';
import OrdersPage from '../pages/OrdersPage';
import AdPage from '../pages/AdPage';
import InventoryPage from '../pages/InventoryPage';
import B2BPage from '../pages/B2BPage';
import FinancePage from '../pages/FinancePage';
import CompliancePage from '../pages/CompliancePage';
import SettingsPage from '../pages/SettingsPage';
import IndependentSiteList from '../pages/IndependentSite/List';

const AppRoutes: React.FC = () => {
  return (
    <Router>
      <Routes>
        {/* 根路径重定向到仪表板 */}
        <Route path="/" element={<Navigate to="/dashboard" />} />
        
        {/* 主布局路由 */}
        <Route path="/" element={<Layout />}>
          {/* 核心功能路由 */}
          <Route path="dashboard" element={<DashboardPage />} />
          <Route path="products" element={<ProductPage />} />
          <Route path="orders" element={<OrdersPage />} />
          <Route path="inventory" element={<InventoryPage />} />
          <Route path="finance" element={<FinancePage />} />
          
          {/* 营销相关路由 */}
          <Route path="marketing/ads" element={<AdPage />} />
          
          {/* B2B相关路由 */}
          <Route path="b2b" element={<B2BPage />} />
          
          {/* 独立站相关路由 */}
          <Route path="independent-sites" element={<IndependentSiteList />} />
          
          {/* 合规与设置路由 */}
          <Route path="compliance" element={<CompliancePage />} />
          <Route path="settings" element={<SettingsPage />} />
        </Route>
      </Routes>
    </Router>
  );
};

export default AppRoutes;