import { RoutesName, routesPaths } from './constant'

export type RouteRaw = typeof routes[number]
export const routes = [
  {
    path: '/',
    name: 'main-layout',
    component: () => import('@/layout/main.vue'),
    children: [
      {
        path: routesPaths[RoutesName.personal],
        name: RoutesName.personal,
        component: () => import('@/views/personal/index.vue')
      },
      {
        path: routesPaths[RoutesName.projects],
        name: RoutesName.projects,
        component: () => import('@/views/project/list.vue')
      },
      {
        path: routesPaths[RoutesName.project],
        name: RoutesName.project,
        component: () => import('@/views/project/detailed.vue'),
        children: [
          {
            path: routesPaths[RoutesName.projectMaterial],
            name: RoutesName.projectMaterial,
            component: () => import('@/views/material/list.vue')
          },
          {
            path: routesPaths[RoutesName.projectMembers],
            name: RoutesName.projectMembers,
            component: () => import('@/views/member/list.vue')
          },
          {
            path: routesPaths[RoutesName.projectScenes],
            name: RoutesName.projectScenes,
            component: () => import('@/views/scene/list.vue')
          },
          {
            path: routesPaths[RoutesName.projectTaggings],
            name: RoutesName.projectTaggings,
            component: () => import('@/views/taggings/list.vue')
          },
          {
            path: routesPaths[RoutesName.projectRoles],
            name: RoutesName.projectRoles,
            component: () => import('@/views/role/list.vue')
          }
        ]
      }
    ]
  },
  {
    path: '/',
    name: 'system-layout',
    component: () => import('@/layout/system.vue'),
    children: [
      {
        path: routesPaths[RoutesName.login],
        name: RoutesName.login,
        component: () => import('@/views/system/login.vue')
      },
      {
        path: '*',
        redirect: routesPaths[RoutesName.login]
      }
    ]
  }
]
