import Layout from '@/layout'

const HomeRoutes = {
  path: '/userManagement',
  component: Layout,
  name: 'UserManagement',
  redirect: '/userManagement/permission',
  //using el svg icon, the elSvgIcon first when at the same time using elSvgIcon and icon
  meta: {
    title: '权限管理',
    elSvgIcon: 'Avatar',
    roles: ['permission_management_menu'],
  },
  children: [
    {
      path: '/userManagement/permission',
      name: 'Permission',
      meta: { title: '权限项管理', roles: ['permission_item_management_page'] },
      component: () => import('@/views/userManagement/permission/index.vue'),
    },
    {
      path: '/userManagement/role',
      name: 'Role',
      meta: { title: '角色管理', roles: ['role_management_page'] },
      redirect: '/userManagement/role',
      component: {
        render: () => h(resolveComponent('router-view')),
      },
      children: [
        {
          path: '/userManagement/role',
          name: 'Role',
          hidden: true,
          component: () => import('@/views/userManagement/role/index.vue'),
        },
        {
          path: '/userManagement/role/auth',
          name: 'Auth',
          hidden: true,
          meta: { title: '角色授权' },
          component: () => import('@/views/userManagement/role/auth.vue'),
        },
      ],
    },
    {
      path: '/userManagement/account',
      name: 'Account',
      meta: { title: '账号管理', roles: ['account_management_page'] },
      redirect: '/userManagement/account',
      component: {
        render: () => h(resolveComponent('router-view')),
      },
      children: [
        {
          path: '/userManagement/account',
          component: () => import('@/views/userManagement/account/index.vue'),
          hidden: true,
        },
        {
          path: '/userManagement/account/accountAuth',
          name: 'AccountAuth',
          hidden: true,
          meta: { title: '账号权限' },
          component: () => import('@/views/userManagement/account/auth.vue'),
        },
      ],
    },
    {
      path: '/userManagement/accountGroup',
      name: 'AccountGroup',
      meta: { title: '账号组管理', roles: ['account_group_management_page'] },
      component: () => import('@/views/userManagement/accountGroup/index.vue'),
    },
    {
      path: '/userManagement/application',
      name: 'Application',
      meta: { title: '应用管理', roles: ['application_managemen_page'] },
      component: () => import('@/views/userManagement/application/index.vue'),
    },
  ],
}

export default [HomeRoutes]
