import type { AppRouteRecordRaw } from '@/router/types'
import { asyncRoutes, RedirectName } from '@/router/constant'

// 404 on a page
export const ErrorPageRoute: AppRouteRecordRaw = {
  path: '/:path(.*)*',
  name: '错误',
  component: asyncRoutes.Layout,
  meta: {
    title: '错误',
    hideBreadcrumb: true
  },
  children: [
    {
      path: '/:path(.*)*',
      name: 'ErrorPageSon',
      component: asyncRoutes.ErrorPage,
      meta: {
        title: '错误',
        hideBreadcrumb: true
      }
    }
  ]
}

export const RedirectRoute: AppRouteRecordRaw = {
  path: '/redirect',
  name: RedirectName,
  component: asyncRoutes.Layout,
  meta: {
    title: RedirectName,
    hideBreadcrumb: true
  },
  children: [
    {
      path: '/redirect/:path(.*)',
      name: RedirectName,
      component: () => import('@/views/redirect/index.vue'),
      meta: {
        title: RedirectName,
        hideBreadcrumb: true
      }
    }
  ]
}

export const BaseRoute: AppRouteRecordRaw = {
  path: '/',
  name: 'home',
  component: asyncRoutes.Layout,
  meta: {
    title: '工作台',
    hideBreadcrumb: true
  },
  children: []
}
