import { RouteRecordRaw } from "vue-router";
import { HOME_URL, LOGIN_URL } from "@/config";
import Layout from "@/layouts/index.vue";

/**
 * LayoutRouter[布局路由]
 */
export const layoutRouter: RouteRecordRaw[] = [
  {
    path: "/",
    name: "layout",
    component: Layout,
    redirect: HOME_URL,
    meta: {
      title: "首页",
      icon: "HomeFilled",
      noCache: false
    },
    children: [
      {
        name: "Home",
        path: HOME_URL,
        component: () => import("@/views/home/index.vue"),
        meta: {
          title: "首页",
          icon: "HomeFilled",
          noCache: false,
          isFull: "1"
        }
      }
    ]
  },
  {
    path: LOGIN_URL,
    name: "login",
    component: () => import("@/views/login/index.vue"),
    meta: {
      title: "登录"
    }
  }
];
export const staticRouter: RouteRecordRaw[] = [
  /** 主控台 */
  {
    path: HOME_URL, // [唯一]
    component: () => import("@/views/home/index.vue"),
    meta: {
      title: "首页", // 标题
      enName: "Master Station", // 英文名称
      icon: "HomeFilled", // 图标 HomeFilled
      isHide: "1", // 代表路由在菜单中是否隐藏，是否隐藏[0隐藏，1显示]
      isLink: "", // 是否外链[有值则是外链]
      isKeepAlive: "0", // 是否缓存路由数据[0是，1否]
      isFull: "1", // 是否缓存全屏[0是，1否]
      isAffix: "0" // 是否缓存固定路由[0是，1否]
    }
  },
  {
    path: "/system/static", // 路由访问路径[唯一]
    name: "staticPage", // 命名路由[唯一]
    component: Layout, // 一级路由，可以将子路由放置Main模块中
    meta: {
      title: "系统管理", // 标题
      enName: "Static Router", // 英文名称
      icon: "House", // 图标
      isHide: "0", // 代表路由在菜单中是否隐藏，是否隐藏[0隐藏，1显示]
      isLink: "", // 是否外链[有值则是外链]
      isKeepAlive: "1", // 是否缓存路由数据[0是，1否]
      isFull: "1", // 是否缓存全屏[0是，1否]
      isAffix: "1", // 是否缓存固定路由[0是，1否]
      activeMenu: HOME_URL // 默认选择哪个路由
    },
    children: [
      {
        path: "/system/dict/data/:dictType", // 路由访问路径[唯一]
        name: "dictDataPage", // 命名路由[唯一]
        component: () => import("@/views/system/dict/data.vue"), // 一级路由，可以将子路由放置Main模块中
        meta: {
          title: "字典详情", // 标题
          enName: "DictData Manage", // 英文名称
          icon: "Flag", // 图标
          isHide: "0", // 代表路由在菜单中是否隐藏，是否隐藏[0隐藏，1显示]
          isLink: "", // 是否外链[有值则是外链]
          isKeepAlive: "0", // 是否缓存路由数据[0是，1否]
          isFull: "1", // 是否缓存全屏[0是，1否]
          isAffix: "1", // 是否缓存固定路由[0是，1否]
          activeMenu: "/system/dict/type" // 默认选择哪个路由
        }
      },
      {
        path: "/system/personage", // 路由访问路径[唯一]
        name: "personagePage", // 命名路由[唯一]
        component: () => import("@/views/system/personage/index.vue"), // 一级路由，可以将子路由放置Main模块中
        meta: {
          title: "个人中心", // 标题
          enName: "Personage Center", // 英文名称
          icon: "User", // 图标
          isHide: "0", // 代表路由在菜单中是否隐藏，是否隐藏[0隐藏，1显示]
          isLink: "", // 是否外链[有值则是外链]
          isKeepAlive: "1", // 是否缓存路由数据[0是，1否]
          isFull: "1", // 是否缓存全屏[0是，1否]
          isAffix: "1", // 是否缓存固定路由[0是，1否]
          activeMenu: "/system/dict/type" // 默认选择哪个路由
        }
      }
    ]
  }
];

/**
 * errorRouter (错误页面路由)
 */
export const errorRouter = [
  {
    path: "/403",
    name: "403",
    component: () => import("@/views/error/403.vue"),
    meta: {
      title: "403页面",
      enName: "403 Page",
      icon: "QuestionFilled",
      isHide: "1",
      isLink: "1",
      isKeepAlive: "0",
      isFull: "1",
      isAffix: "1"
    }
  },
  {
    path: "/404",
    name: "404",
    component: () => import("@/views/error/404.vue"),
    meta: {
      title: "404页面",
      enName: "404 Page",
      icon: "CircleCloseFilled",
      isHide: "1",
      isLink: "1",
      isKeepAlive: "0",
      isFull: "1",
      isAffix: "1"
    }
  },
  {
    path: "/500",
    name: "500",
    component: () => import("@/views/error/500.vue"),
    meta: {
      title: "500页面",
      enName: "500 Page",
      icon: "WarningFilled",
      isHide: "1",
      isLink: "1",
      isKeepAlive: "0",
      isFull: "1",
      isAffix: "1"
    }
  },
  {
    path: "/:pathMatch(.*)*",
    component: () => import("@/views/error/404.vue")
  }
];
