import { createHashRouter } from "react-router-dom";
import LayOut from "@/components/layout/layout";
import { rbac } from "./routers/rbac_router";
import { sku } from "./routers/sku_router";

const routers = createHashRouter([
  {
    path: "/",
    element: <LayOut />,
    children: [
      {
        path: "/",
        index: true,
        lazy: async() => ({
          Component:(await import("@/pages/dashbord")).default,
        })
      },
      {
        path: "/user/list",
        index: true,
        lazy: async() => ({
          Component:(await import("@/pages/user/user")).default,
        })
      },
      ...rbac,
      ...sku,
      {
        path: "/order/list",
        index: true,
        lazy: async() => ({
          Component:(await import("@/pages/order")).default,
        })
      },
      {
        path: "/city/list",
        index: true,
        lazy: async() => ({
          Component:(await import("@/pages/city")).default,
        })
      },
    ],
  },
  {
    path: "/login",
    lazy: async() => ({
      Component:(await import("@/pages/login/login")).default,
    })
  },
]);

export { routers };
