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 Login = Loadable(lazy(() => import('pages/nearle/login')));
const Dashboard = Loadable(lazy(() => import('pages/nearle/dashboard')));

const Customers = Loadable(lazy(() => import('pages/nearle/clients/customers')));

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

const Accountsettings = Loadable(lazy(() => import('pages/nearle/accountsettings')));

// const Createorder = Loadable(lazy(() => import('pages/nearle/orders/createorder')));
const Createclient = Loadable(lazy(() => import('pages/nearle/clients/createCustomer')));

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

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

const Invoice = Loadable(lazy(() => import('pages/nearle/invoice/invoice')));
const InvoicePreview = Loadable(lazy(() => import('../pages/nearle/invoice/invoicePreview')));

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

const MainRoutes = {
  path: '/',
  children: [
    {
      path: '/',
      element: (
        // <AuthGuard>
        <MainLayout />
        // </AuthGuard>
      ),
      children: [
        // {
        //   path: 'sample-page',
        //   element: <SamplePage />
        // },
        {
          path: 'dashboard',
          element: <Dashboard />
        },
        {
          path: 'customers',
          element: <Customers />
        },
        // {
        //   path: 'clients1',
        //   element: <Customers />
        // },
        {
          path: 'orders',
          element: <Orders />
        },
        {
          path: 'accountsettings',
          element: <Accountsettings />
        },
        // {
        //   path: 'orders/create1',
        //   element: <Createorder />
        // },
        {
          path: 'orders/create',
          element: <Createorder1 />
        },
        {
          path: 'orders/details',
          element: <Details />
        },
        {
          path: 'customers/create',
          element: <Createclient />
        },
        {
          path: 'reports/ordersdetails',
          element: <OrdersDetails />
        },
        {
          path: 'invoice',
          element: <Invoice />
        },
        {
          path: 'invoice/preview',
          element: <InvoicePreview />
        }
      ]
    },

    {
      path: '/login',
      element: <Login />
    },
    {
      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;
