import { ModuleClientParams } from "@erp/core/client";
import { lazy } from "react";
import { Outlet, RouteObject } from "react-router-dom";

// Lazy load components
const CustomerInvoicesLayout = lazy(() =>
  import("./components").then((m) => ({ default: m.CustomerInvoicesLayout }))
);

const CustomerInvoicesList = lazy(() =>
  import("./pages").then((m) => ({ default: m.CustomerInvoicesList }))
);

const CustomerInvoiceAdd = lazy(() =>
  import("./pages").then((m) => ({ default: m.CustomerInvoiceCreate }))
);

//const LogoutPage = lazy(() => import("./app").then((m) => ({ default: m.LogoutPage })));

/*const DealerLayout = lazy(() => import("./app").then((m) => ({ default: m.DealerLayout })));
const DealersList = lazy(() => import("./app").then((m) => ({ default: m.DealersList })));

const LoginPageWithLanguageSelector = lazy(() =>
  import("./app").then((m) => ({ default: m.LoginPageWithLanguageSelector }))
);


const CustomerInvoiceEdit = lazy(() => import("./app").then((m) => ({ default: m.CustomerInvoiceEdit })));
const SettingsEditor = lazy(() => import("./app").then((m) => ({ default: m.SettingsEditor })));
const SettingsLayout = lazy(() => import("./app").then((m) => ({ default: m.SettingsLayout })));
const CatalogLayout = lazy(() => import("./app").then((m) => ({ default: m.CatalogLayout })));
const CatalogList = lazy(() => import("./app").then((m) => ({ default: m.CatalogList })));
const DashboardPage = lazy(() => import("./app").then((m) => ({ default: m.DashboardPage })));
const CustomerInvoicesLayout = lazy(() => import("./app").then((m) => ({ default: m.CustomerInvoicesLayout })));
const CustomerInvoicesList = lazy(() => import("./app").then((m) => ({ default: m.CustomerInvoicesList })));*/

export const CustomerInvoiceRoutes = (params: ModuleClientParams): RouteObject[] => {
  return [
    {
      path: "customer-invoices",
      element: (
        <CustomerInvoicesLayout>
          <Outlet context={params} />
        </CustomerInvoicesLayout>
      ),
      children: [
        { path: "", index: true, element: <CustomerInvoicesList /> }, // index
        { path: "list", element: <CustomerInvoicesList /> },
        { path: "create", element: <CustomerInvoiceAdd /> },

        //
        /*{ path: "create", element: <CustomerInvoicesList /> },
        { path: ":id", element: <CustomerInvoicesList /> },
        { path: ":id/edit", element: <CustomerInvoicesList /> },
        { path: ":id/delete", element: <CustomerInvoicesList /> },
        { path: ":id/view", element: <CustomerInvoicesList /> },
        { path: ":id/print", element: <CustomerInvoicesList /> },
        { path: ":id/email", element: <CustomerInvoicesList /> },
        { path: ":id/download", element: <CustomerInvoicesList /> },
        { path: ":id/duplicate", element: <CustomerInvoicesList /> },
        { path: ":id/preview", element: <CustomerInvoicesList /> },*/
      ],
    },
  ];
};
