import { RouteRecordRaw } from 'vue-router';
import { PageEnum } from '@/enums/pageEnum';

// 引入路径
const importPath = {
  'PageEnum.BASE_HOME_NAME': () => import('@/views/project/index.vue'),
  'PageEnum.BASE_HOME_ITEMS_NAME': () => import('@/views/project/items/index.vue'),
  'PageEnum.BASE_HOME_REMOTE_NAME': () => import('@/views/project/remote/list/index.vue'),
  'PageEnum.BASE_HOME_REMOTE_CREATE_NAME': () => import('@/views/project/remote/create/index.ts'),
  'PageEnum.BASE_HOME_TEMPLATE_NAME': () => import('@/views/project/mtTemplate/index.vue'),
};

export const projectRoutes: RouteRecordRaw = {
  path: PageEnum.BASE_HOME,
  name: PageEnum.BASE_HOME_NAME,
  component: importPath['PageEnum.BASE_HOME_NAME'],
  redirect: PageEnum.BASE_HOME_ITEMS,
  meta: {
    title: '项目',
    isRoot: true,
    hideBreadcrumb: true,
    hideMenu: true,
  },
  children: [
    {
      path: PageEnum.BASE_HOME_ITEMS,
      name: PageEnum.BASE_HOME_ITEMS_NAME,
      component: importPath['PageEnum.BASE_HOME_ITEMS_NAME'],
      meta: {
        title: '我的项目',
      },
    },
    {
      path: PageEnum.BASE_HOME_REMOTE,
      name: PageEnum.BASE_HOME_REMOTE_NAME,
      redirect: PageEnum.BASE_HOME_LIST_REMOTE,
      meta: {
        title: '远程组件',
      },
      children: [
        {
          path: PageEnum.BASE_HOME_LIST_REMOTE,
          name: PageEnum.BASE_HOME_LIST_REMOTE_NAME,
          meta: {
            title: '远程组件列表',
            hideMenu: true,
          },
          component: importPath['PageEnum.BASE_HOME_REMOTE_NAME'],
        },
        {
          path: PageEnum.BASE_HOME_CREATE_REMOTE,
          name: PageEnum.BASE_HOME_CREATE_REMOTE_NAME,
          meta: {
            title: '创建远程组件',
            hideMenu: true,
          },
          component: importPath['PageEnum.BASE_HOME_REMOTE_CREATE_NAME'],
        },
        {
          path: PageEnum.BASE_HOME_EDIT_REMOTE,
          name: PageEnum.BASE_HOME_EDIT_REMOTE_NAME,
          meta: {
            title: '编辑远程组件',
            hideMenu: true,
          },
          component: importPath['PageEnum.BASE_HOME_REMOTE_CREATE_NAME'],
        },
      ]
    },
    {
      path: PageEnum.BASE_HOME_TEMPLATE,
      name: PageEnum.BASE_HOME_TEMPLATE_NAME,
      component: importPath['PageEnum.BASE_HOME_TEMPLATE_NAME'],
      meta: {
        title: '我的模板',
      },
    },
  ],
};

