import { lazy } from 'react';

// project import
import MainLayout from 'layout/MainLayout';
import CommonLayout from 'layout/CommonLayout';
import Loadable from 'components/Loadable'; // for suspense
// 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 Catalogues = Loadable(lazy(() => import('../pages/nearle/Products/Catalogues')));
const ProductStocks = Loadable(lazy(() => import('../pages/nearle/Products/Products')));
const StockStatement = Loadable(lazy(() => import('../pages/nearle/Products/StockStatement')));
const StockLedger = Loadable(lazy(() => import('../pages/nearle/Products/StockLedger')));

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

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

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 MultipleOrders = Loadable(lazy(() => import('pages/nearle/orders/multipleOrders')));

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')));

const Users = Loadable(lazy(() => import('../pages/nearle/users/Users')));
const CreateUsers = Loadable(lazy(() => import('../pages/nearle/users/CreateUsers')));
const EditUser = Loadable(lazy(() => import('../pages/nearle/users/EditUsers')));

const Locations = Loadable(lazy(() => import('../pages/nearle/locations/Locations')));
const CreateLocations = Loadable(lazy(() => import('../pages/nearle/locations/CreateLocation')));

const Subscription = Loadable(lazy(() => import('../pages/nearle/subscription/Subscription')));

const Demo1 = Loadable(lazy(() => import('pages/demo/demo1')));
const Demo2 = Loadable(lazy(() => import('pages/demo/demo2')));
const Demo3 = Loadable(lazy(() => import('pages/demo/demo3')));
const Demo4 = Loadable(lazy(() => import('pages/demo/demo4')));
const Demoout1 = Loadable(lazy(() => import('pages/demo/demoout1')));
const Demoout2 = Loadable(lazy(() => import('pages/demo/demoout2')));

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

const MainRoutes = {
  path: '/',
  children: [
    {
      path: '/',
      element: (
        // <AuthGuard>
        <MainLayout />
        // </AuthGuard>
      ),
      children: [
        // {
        //   path: 'sample-page',
        //   element: <SamplePage />
        // },
        {
          path: 'demoout1',
          element: <Demoout1 />
        },
        {
          path: 'demoout2',
          element: <Demoout2 />
        },

        {
          path: 'demo1',
          element: <Demo1 />
        },
        {
          path: 'demo2',
          element: <Demo2 />
        },
        {
          path: 'demo3',
          element: <Demo3 />
        },
        {
          path: 'demo4',
          element: <Demo4 />
        },
        {
          path: 'dashboard',
          element: <Dashboard />
        },
        // {
        //   path: 'products',
        //   element: <Products />
        // },

        {
          path: 'catalogues',
          element: <Catalogues />
        },
        {
          path: 'products',
          element: <ProductStocks />
        },
        {
          path: 'stocks/statement',
          element: <StockStatement />
        },
        {
          path: 'stocks/ledger',
          element: <StockLedger />
        },
        {
          path: 'customers',
          element: <Customers />
        },

        // {
        //   path: 'clients1',
        //   element: <Customers />
        // },
        {
          path: 'orders',
          element: <Orders />
        },
        {
          path: 'deliveries',
          element: <Deliveries />
        },

        {
          path: 'testingorders',
          element: <TestingOrder />
        },
        {
          path: 'accountsettings',
          element: <Accountsettings />
        },
        // {
        //   path: 'orders/create1',
        //   element: <Createorder />
        // },
        {
          path: 'orders/create',
          element: <Createorder1 />
        },
        {
          path: 'orders/createorders',
          element: <MultipleOrders />
        },
        {
          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: 'users',
          element: <Users />
        },
        {
          path: 'users/create',
          element: <CreateUsers />
        },
        {
          path: 'users/edit',
          element: <EditUser />
        },
        {
          path: 'locations',
          element: <Locations />
        },
        {
          path: 'location/create',
          element: <CreateLocations />
        },
        {
          path: 'subscription',
          element: <Subscription />
        }
      ]
    },

    {
      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;
