import { RouteRecordRaw } from "vue-router";

import PermissionLevel from "src/entities/PermissionLevel";

import RedirectPage from "src/RedirectPage.vue";
import Login from "pages/Login.vue";
import MainLayout from "layouts/MainLayout.vue";
import Index from "pages/Index.vue";

import PadLogin from "src/pad/Login.vue";
import PadMainLayout from "src/pad/MainLayout.vue";
import PadIndex from "src/pad/Index.vue";

import Error404 from "pages/Error404.vue";

const routes: RouteRecordRaw[] = [
  {
    path: "/",
    meta: {},
    component: RedirectPage,
  },
  {
    path: "/pc/login",
    component: Login,
  },
  {
    path: "/pc",
    meta: {
      permission_level: PermissionLevel.User,
    },
    component: MainLayout,
    children: [
      {
        path: "",
        component: Index,
        meta: {
          permission_level: PermissionLevel.User,
        },
      },
    ],
  },
  {
    path: "/pad/login",
    component: PadLogin,
  },
  {
    path: "/pad",
    meta: {
      permission_level: PermissionLevel.User,
    },
    component: PadMainLayout,
    children: [
      {
        path: "",
        component: PadIndex,
        meta: {
          permission_level: PermissionLevel.User,
        },
      },
    ],
  },

  // Always leave this as last one,
  // but you can also remove it
  {
    path: "/:catchAll(.*)*",
    component: Error404,
  },
];

export default routes;
