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"))
);
// orders
const Orders = Loadable(lazy(() => import("../pages/orders/orders")));
// deliveries
const Deliveries = Loadable(
  lazy(() => import("../pages/deliveries/deliveries"))
);
// products
const Products = Loadable(lazy(() => import("../pages/Products/Products")));
const Addproducts = Loadable(
  lazy(() => import("../pages/Products/Addproducts"))
);
// clients
const Clients = Loadable(lazy(() => import("../pages/clients/clients")));
// ClientsPricing
const ClientsPricing = Loadable(
  lazy(() => import("../pages/clientspricing/clientsPricing"))
);
// customers
const Customers = Loadable(lazy(() => import("../pages/customers/customers")));
// riders
const Riders = Loadable(lazy(() => import("../pages/riders/riders")));
// invoice
const Invoice = Loadable(lazy(() => import("../pages/invoice/invoice")));
const CreateInvoice = Loadable(
  lazy(() => import("../pages/invoice/createInvoice"))
);
const InvoicePreview = Loadable(
  lazy(() => import("../pages/invoice/invoicePreview"))
);
const CreateInvoicePreview = Loadable(
  lazy(() => import("../pages/invoice/createInvoicePreview"))
);

// reports
const OrdersSummary = Loadable(
  lazy(() => import("../pages/reports/ordersSummary"))
);
const OrdersDetails = Loadable(
  lazy(() => import("../pages/reports/ordersDetails"))
);
const RidersSummary = Loadable(
  lazy(() => import("../pages/reports/ridersSummary"))
);
const RidersLogs = Loadable(lazy(() => import("pages/reports/ridersLogs")));

// requests
const Requests = Loadable(lazy(() => import("../pages/requests/requests")));

const Dashboard = Loadable(lazy(() => import("../pages/dashboard/dashboard")));
const Tenants = Loadable(lazy(() => import("../pages/tenants/tenants")));
const CloudStore = Loadable(
  lazy(() => import("../pages/cloudStore/cloudStore"))
);
const Createrider = Loadable(lazy(() => import("pages/riders/createrider")));
const EditRider = Loadable(lazy(() => import("pages/riders/editRider")));

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

const MainRoutes = {
  path: "/",
  children: [
    {
      path: "/",
      element: (
        <AuthGuard>
          <MainLayout />
        </AuthGuard>
      ),
      children: [
        // {
        //   path: "sample-page",
        //   element: <SamplePage />,
        // },

        {
          path: "orders",
          element: <Orders />,
        },
        {
          path: "deliveries",
          element: <Deliveries />,
        },
        {
          path: "products",
          element: <Products />,
        },
        {
          path: "products/add",
          element: <Addproducts />,
        },
        {
          path: "clients",
          element: <Clients />,
        },
        {
          path: "clients_pricing",
          element: <ClientsPricing />,
        },
        {
          path: "customers",
          element: <Customers />,
        },
        {
          path: "riders",
          element: <Riders />,
        },
        {
          path: "riders/create",
          element: <Createrider />,
        },

        {
          path: "riders/edit",
          element: <EditRider />,
        },
        {
          path: "invoice",
          element: <Invoice />,
        },
        {
          path: "invoice/preview",
          element: <InvoicePreview />,
        },
        {
          path: "invoice/create",
          element: <CreateInvoice />,
        },
        {
          path: "invoice/create/preview",
          element: <CreateInvoicePreview />,
        },
        {
          path: "reports/ordersSummary",
          element: <OrdersSummary />,
        },
        {
          path: "reports/ordersDetails",
          element: <OrdersDetails />,
        },
        {
          path: "/reports/ridersSummary",
          element: <RidersSummary />,
        },
        {
          path: "reports/riderslogs",
          element: <RidersLogs />,
        },
        {
          path: "requests",
          element: <Requests />,
        },

        // {
        //   path: "dashboard",
        //   element: <Dashboard />,
        // },
        // {
        //   path: "tenants",
        //   element: <Tenants />,
        // },

        // {
        //   path: "cloudstore",
        //   element: <CloudStore />,
        // },
      ],
    },
    {
      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;
