import { lazy } from 'react';

// project import
import MainLayout from 'layout/MainLayout';
import CommonLayout from 'layout/CommonLayout';
import Loadable from 'components/Loadable';
// import AuthGuard from 'utils/route-guard/AuthGuard';

// pages routing
const MaintenanceError = Loadable(lazy(() => import('pages/maintenance/404')));
const MaintenanceError500 = Loadable(lazy(() => import('pages/maintenance/500')));
const MaintenanceUnderConstruction = Loadable(lazy(() => import('pages/maintenance/under-construction')));
const MaintenanceComingSoon = Loadable(lazy(() => import('pages/maintenance/coming-soon')));

// render - sample page
// const SamplePage = Loadable(lazy(() => import('pages/extra-pages/sample-page')));
// const Dashboard = Loadable(lazy(() => import('pages/nearle/dashboard')));

const Orders = Loadable(lazy(() => import('pages/nearle/orders/orders')));
const OrdersPreview = Loadable(lazy(() => import('pages/nearle/orders/OrdersPreview')));

const Deliveries = Loadable(lazy(() => import('pages/nearle/deliveries/deliveries')));

const Tenants = Loadable(lazy(() => import('pages/nearle/clients/Tenants')));
const ClientsPricing = Loadable(lazy(() => import('pages/nearle/clientPricing/clientPricing')));

const ViewProfile = Loadable(lazy(() => import('pages/nearle/viewProfile')));

const Createorder1 = Loadable(lazy(() => import('pages/nearle/orders/createorder1')));
const MultipleOrders = Loadable(lazy(() => import('pages/nearle/orders/multipleOrders')));

const Createclient = Loadable(lazy(() => import('pages/nearle/clients/createclient')));

const OrdersSummary = Loadable(lazy(() => import('pages/nearle/reports/ordersSummary')));
const OrdersDetails = Loadable(lazy(() => import('pages/nearle/reports/ordersDetails')));
const RidersSummary = Loadable(lazy(() => import('pages/nearle/reports/ridersSummary')));

const Riders = Loadable(lazy(() => import('pages/nearle/riders/riders')));
const Createrider = Loadable(lazy(() => import('pages/nearle/riders/createrider')));
const EditRider = Loadable(lazy(() => import('pages/nearle/riders/editRider')));
const Dispatch = Loadable(lazy(() => import('pages/nearle/dispatch/Dispatch')));
const DispatchPreview = Loadable(lazy(() => import('pages/nearle/dispatch/Preview')));

const Customers = Loadable(lazy(() => import('pages/nearle/customers/customers')));
const Hubs = Loadable(lazy(() => import('pages/nearle/hubs/hubs')));
const Vehicles = Loadable(lazy(() => import('pages/nearle/vehicles/vehicles')));
const AppUsers = Loadable(lazy(() => import('pages/nearle/appUsers/appUsers')));
const Tripsheets = Loadable(lazy(() => import('pages/nearle/tripsheets/tripsheets')));
const Exceptions = Loadable(lazy(() => import('pages/nearle/exceptions/exceptions')));
const CompetitiveIntel = Loadable(lazy(() => import('pages/nearle/competitiveIntel/competitiveIntel')));

// ==============================|| MAIN ROUTING ||============================== //

const MainRoutes = {
  path: '/',
  children: [
    {
      path: '/',
      element: (
        // <AuthGuard>
        <MainLayout />
        // </AuthGuard>
      ),
      children: [
        {
          path: 'doormile',
          children: [
            {
              path: 'orders',
              element: <Orders />
            },
            {
              path: 'orders/preview',
              element: <OrdersPreview />
            },
            {
              path: 'deliveries',
              element: <Deliveries />
            },
            {
              path: 'tenants',
              element: <Tenants />
            },
            {
              path: 'pricing',
              element: <ClientsPricing />
            },
            {
              path: 'riders',
              element: <Riders />
            },
            {
              path: 'riders/create',
              element: <Createrider />
            },
            {
              path: 'riders/edit',
              element: <EditRider />
            },

            {
              path: 'orders/create',
              element: <Createorder1 />
            },
            {
              path: 'orders/createorders',
              element: <MultipleOrders />
            },
            {
              path: 'clients/create',
              element: <Createclient />
            },
            {
              path: 'reports',
              children: [
                {
                  path: 'orderssummary',
                  element: <OrdersSummary />
                },
                {
                  path: 'ordersdetails',
                  element: <OrdersDetails />
                },
                {
                  path: 'riderssummary',
                  element: <RidersSummary />
                }
              ]
            },
            {
              path: 'dispatch',
              element: <Dispatch />
            },
            {
              path: 'dispatch/preview',
              element: <DispatchPreview />
            },
            {
              path: 'customers',
              element: <Customers />
            },
            {
              path: 'hubs',
              element: <Hubs />
            },
            {
              path: 'vehicles',
              element: <Vehicles />
            },
            {
              path: 'app-users',
              element: <AppUsers />
            },
            {
              path: 'tripsheets',
              element: <Tripsheets />
            },
            {
              path: 'exceptions',
              element: <Exceptions />
            },
            {
              path: 'competitive-intel',
              element: <CompetitiveIntel />
            }
          ]
        },

        {
          path: 'viewprofile',
          element: <ViewProfile />
        }

        // {
        //   path: 'orders/create',
        //   element: <Createorder />
        // },
      ]
    },

    {
      path: '/maintenance',
      element: <CommonLayout />,
      children: [
        {
          path: '404',
          element: <MaintenanceError />
        },
        {
          path: '500',
          element: <MaintenanceError500 />
        },
        {
          path: 'under-construction',
          element: <MaintenanceUnderConstruction />
        },
        {
          path: 'coming-soon',
          element: <MaintenanceComingSoon />
        }
      ]
    }
  ]
};

export default MainRoutes;
