import { Navigate } from 'react-router-dom';

import type { AppRouteObject } from './types';

import Layout from '@/layouts/BasicLayout';
import Forbidden from '@/pages/error/403';
import NotFound from '@/pages/error/404';
import ServerError from '@/pages/error/500';
import Redirect from '@/pages/redirect';
import Home from '@/pages/home';
import RouteDemo from '@/pages/routeDemo';
import FeatureDemo from '@/pages/featureDemo';
import Pricing from '@/pages/pricing';

const routes: AppRouteObject[] = [
    {
        path: '/',
        element: <Layout />,
        children: [
            {
                index: true,
                element: <Navigate to="/home" replace />,
            },
            {
                name: 'home',
                path: '/home',
                element: <Home />,
            },
            {
                name: 'pricing',
                path: '/pricing',
                element: <Pricing />,
            },
            {
                name: 'featureDemo',
                path: '/feature-demo',
                element: <FeatureDemo />,
            },
            {
                name: 'routeDemo',
                path: '/route-demo/:id?',
                element: <RouteDemo />,
            },
            {
                name: 'test',
                path: '/test',
                children: [
                    {
                        name: 'test1',
                        path: '/test/test1',
                        element: <div className="text-white">test1</div>,
                    },
                    {
                        name: 'test2',
                        path: '/test/test2',
                        element: <div className="text-white">test2</div>,
                    },
                ],
            },
        ],
    },
    {
        name: 'to',
        path: '/to',
        hideInMenu: true,
        element: <Redirect />,
    },
    {
        name: '403',
        path: '/403',
        element: <Forbidden />,
        hideInMenu: true,
    },
    {
        name: '500',
        path: '/500',
        element: <ServerError />,
        hideInMenu: true,
    },
    {
        name: '404',
        path: '*',
        element: <NotFound />,
        hideInMenu: true,
    },
] as AppRouteObject[];

export default routes;
