import { createBrowserRouter, Navigate } from 'react-router';
import MainLayout from '@/layouts/MainLayout';
import AiImagePage from '@/pages/ai-image';
import CollectionPage from '@/pages/collection/CollectionPage';
import ProductEditPage from '@/pages/product/ProductEditPage';
import ShopsPage from '@/pages/shops/ShopsPage';
import TrialPage from '@/pages/trial/TrialPage';

export const router = createBrowserRouter([
    {
        path: '/',
        element: <MainLayout />,
        children: [
            { index: true, element: <Navigate to="/collection" replace /> },
            { path: 'collection', element: <CollectionPage /> },
            { path: 'product/:id', element: <ProductEditPage /> },
            { path: 'trial/:id', element: <TrialPage /> },
            { path: 'shops', element: <ShopsPage /> },
            { path: 'ai-image', element: <AiImagePage /> },
        ],
    },
    // 后续加账户体系时再启用 /login
    { path: '*', element: <Navigate to="/" replace /> },
]);
