import { createBrowserRouter } from 'react-router';
import { ProtectedRoute } from './components/ProtectedRoute';
import { ErrorPage } from './components/ErrorPage';
import { NotFoundPage } from './components/NotFoundPage';
import HomePage from './pages/HomePage';
import { MainLayout } from './layouts/MainLayout';
import LoginPage from './pages/LoginPage';
import RegisterPage from './pages/RegisterPage';
import MemberPage from './pages/MemberPage';
import WordPreview from './pages/WordPreview';
import PricingPage from './pages/PricingPage';
import ProfilePage from './pages/ProfilePage';
import RechargePage from './pages/RechargePage';
import TemplateSquare from './pages/TemplateSquare';
import AboutPage from './pages/AboutPage';
import AIToolsPage from './pages/AIToolsPage';
import DesignPlanningPage from './pages/DesignPlanningPage';
import SoftwareRequirementsPage from './pages/SoftwareRequirementsPage';
import TalentSharingPage from './pages/TalentSharingPage';
import ContactPage from './pages/ContactPage';

export const router = createBrowserRouter([
  {
    path: '/',
    element: <MainLayout />,
    children: [
      {
        path: '',
        element: <HomePage />
      },
      {
        path: 'about',
        element: <AboutPage />
      },
      {
        path: 'ai-tools',
        element: <AIToolsPage />
      },
      {
        path: 'design-planning',
        element: <DesignPlanningPage />
      },
      {
        path: 'software-requirements',
        element: <SoftwareRequirementsPage />
      },
      {
        path: 'talent-sharing',
        element: <TalentSharingPage />
      },
      {
        path: 'contact',
        element: <ContactPage />
      },
      {
        path: 'templates',
        element: <TemplateSquare />
      },
      {
        path: 'pricing',
        element: <PricingPage />
      },
      {
        path: 'login',
        element: <LoginPage />
      },
      {
        path: 'register',
        element: <RegisterPage />
      },
      {
        path: 'word-preview',
        element: (
          <ProtectedRoute>
            <WordPreview />
          </ProtectedRoute>
        )
      },
      {
        path: 'member',
        element: (
          <ProtectedRoute>
            <MemberPage />
          </ProtectedRoute>
        )
      },
      {
        path: 'member/profile',
        element: (
          <ProtectedRoute>
            <ProfilePage />
          </ProtectedRoute>
        )
      },
      {
        path: 'member/recharge',
        element: (
          <ProtectedRoute>
            <RechargePage />
          </ProtectedRoute>
        )
      },
      {
        path: '*',
        element: <NotFoundPage />,
        errorElement: <ErrorPage />
      },
    ],
  },
]);