import Vue from 'vue'
import VueRouter from 'vue-router'

Vue.use(VueRouter)

const routes = [
  {
    path: '/',
    redirect: '/login'
  },
  {
    path: '/login',
    name: 'login',

    component: () => import('../views/login/index.vue')
  },
  {
    path: '/home',
    name: 'home',
    redirect: '/home/user',
    component: () => import('../views/HomeView.vue'),
    children: [
      {
        path: 'user',
        name: 'user',
        component: () => import('../views/userManagement/index.vue'),
        children: [
          {
            path: 'person',
            name: 'person',
            component: () => import('../views/userManagement/personManagement/index.vue'),
          },
          {
            path: 'group',
            name: 'group',
            component: () => import('../views/userManagement/groupManagement/index.vue'),
          },
        ]
      },
      {
        path: 'role',
        name: 'role',
        component: () => import('../views/permissionManagement/index.vue')
      },

      {
        path: 'permission',
        name: 'permission',
        component: () => import('../views/permissionManagement/index.vue')
      },
      {
        path: 'system',
        name: 'system',
        component: () => import('../views/systemManagement/index.vue'),
        children: [
          {
            path: 'strategy',
            name: 'strategy',
            component: () => import('../views/systemManagement/strategyConfiguration/index.vue')
          },
          {
            path: 'message',
            name: 'message',
            component: () => import('../views/systemManagement/messageConfiguration/commonMessage.vue')
          },
          {
            path: 'info',
            name: 'info',
            component: () => import('../views/systemManagement/infoConfiguration/index.vue')
          },
          {
            path: 'index',
            name: 'index',
            component: () => import('../views/systemManagement/indexConfiguration/index.vue')
          },
        ]
      },
      {
        path: 'device',
        name: 'device',
        component: () => import('../views/deviceManagement/index.vue'),
        children: [
          {
            path: 'config',
            name: 'config',
            component: () => import('../views/deviceManagement/deviceConfig.vue'),
          },
          {
            path: 'warning',
            name: 'warning',
            component: () => import('../views/deviceManagement/deviceWarning.vue'),
          }
        ]
      },
      {
        path: 'data',
        name: 'data',
        component: () => import('../views/dataManagement/index.vue'),
        children: [
          {
            path: 'statement',
            name: 'statement',
            component: () => import('../views/dataManagement/statementConfig.vue'),
          },
          {
            path: 'report',
            name: 'report',
            component: () => import('../views/dataManagement/reportConfig.vue'),
          },
          {
            path: 'basicInfo',
            name: 'basicInfo',
            component: () => import('../views/dataManagement/basicInfo/index.vue'),
          }
        ]
      },
      {
        path: 'service',
        name: 'service',
        component: () => import('../views/servicesManagement/index.vue'),
        children: [
          {
            path: 'all',
            name: 'allServices',
            component: () => import('../views/servicesManagement/allServices.vue'),
          },
          {
            path: 'installed',
            name: 'installed',
            component: () => import('../views/servicesManagement/allServices.vue'),
          },
          {
            path: 'uninstall',
            name: 'uninstall',
            component: () => import('../views/servicesManagement/allServices.vue'),
          }
        ]
      },
      {
        path: 'security',
        name: 'security',
        redirect: '/home/security/logMonitor',
        component: () => import('../views/securityManagement/index.vue'),
        children: [
          {
            path: 'logMonitor',
            name: 'logMonitor',
            component: () => import('../views/securityManagement/logMonitor.vue'),
          },
          {
            path: 'systemMonitor',
            name: 'systemMonitor',
            component: () => import('../views/securityManagement/systemMonitor/index.vue'),
          },
        ]
      }
    ]
  },
]

const router = new VueRouter({
  mode: 'history',
  base: process.env.BASE_URL,
  routes
})

export default router
