import { createRouter, createWebHashHistory, RouteRecordRaw } from "vue-router";
import ProfileLayout from "./layout";

const routes: Array<RouteRecordRaw> = [
  // {
  //   path: "/",
  //   name: "homePage",
  //   meta: {
  //     needAuth: true,
  //   },
  //   component: () => import("./Home"),
  // },
  {
    path: "/create/:id",
    name: "create",
    meta: {
      needAuth: true,
    },
    component: () => import("./CreateMat"),
  },
  {
    path: "/",
    name: "workbench",
    meta: {
      needAuth: true,
    },
    redirect: "/workbench/promotion",
    component: ProfileLayout,
    children: [
      {
        path: "/workbench/promotion",
        name: "promotion",
        component: () => import("./Promotion2"),
      },
      {
        path: "/workbench/myComps",
        name: "myComps",
        component: () => import("./MyComps"),
      },
      {
        path: "/workstage/material",
        name: "material",
        component: () => import("./Material2"),
      },
      {
        path: "/settings",
        name: "settings",
        component: () => import("./Settings"),
      },
    ],
  },
  {
    path: "/login",
    name: "login",
    component: () => import("./Login"),
  },
  {
    path: "/forget",
    name: "forget",
    component: () => import("@queenjs-modules/auth/components/Forget"),
  },
  {
    path: "/register",
    name: "register",
    component: () => import("@queenjs-modules/auth/components/Register"),
  },
];

const router = createRouter({
  history: createWebHashHistory(),
  routes,
});

export default router;
