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',
    meta: { requrieAuth: true },
    redirect: '/home/user/person',
    component: () => import('../views/HomeView.vue'),
    children: [
      {
        path: 'user',
        name: 'user',
        meta: { requrieAuth: true },
        redirect:'/home/user/person',
        component:() => import('../views/userManagement/index.vue'),
        children: [
          {
            path: 'person',
            name: 'person',
            meta: { requrieAuth: true },
            component: () => import('../views/userManagement/personManagement/index.vue'),
          },
          {
            path: 'group',
            name: 'group',
            meta: { requrieAuth: true },
            component: () => import('../views/userManagement/groupManagement/index.vue'),
          },
        ],
      },
      {
        path: 'role',
        name: 'role',
        meta: { requrieAuth: true },
        component: () => import('../views/permissionManagement/roleOverview.vue')
      },
      {
        path: 'system',
        name: 'system',
        meta: { requrieAuth: true },
        redirect:'home/system/strategy',
        component: () => import('../views/systemManagement/index.vue'),
        children: [
          {
            path: 'strategy',
            name: 'strategy',
            meta: { requrieAuth: true },
            component: () => import('../views/systemManagement/strategyConfiguration/index.vue')
          },
          {
            path: 'message',
            name: 'message',
            meta: { requrieAuth: true },
            component: () => import('../views/systemManagement/messageConfiguration/commonMessage.vue')
          },
          {
            path: 'info',
            name: 'info',
            meta: { requrieAuth: true },
            component: () => import('../views/systemManagement/infoConfiguration/index.vue')
          },
          {
            path: 'index',
            name: 'index',
            meta: { requrieAuth: true },
            component: () => import('../views/systemManagement/indexConfiguration/index.vue')
          },
        ],
      },
      {
        path: 'device',
        name: 'device',
        meta: { requrieAuth: true },
        component: () => import('../views/deviceManagement/index.vue'),
        children: [
          {
            path: 'config',
            name: 'config',
            meta: { requrieAuth: true },
            component: () => import('../views/deviceManagement/deviceConfig.vue'),
          },
          {
            path: 'warning',
            name: 'warning',
            meta: { requrieAuth: true },
            component: () => import('../views/deviceManagement/deviceWarning.vue'),
          }
        ]
      },
      {
        path: 'data',
        name: 'data',
        meta: { requrieAuth: true },
        component: () => import('../views/dataManagement/index.vue'),
        children: [
          {
            path: 'statement',
            name: 'statement',
            meta: { requrieAuth: true },
            component: () => import('../views/dataManagement/statementConfig.vue'),
          },
          {
            path: 'report',
            name: 'report',
            meta: { requrieAuth: true },
            component: () => import('../views/dataManagement/reportConfig.vue'),
          },
          {
            path: 'basicInfo',
            name: 'basicInfo',
            meta: { requrieAuth: true },
            component: () => import('../views/dataManagement/basicInfo/index.vue'),
          }
        ]
      },
      {
        path: 'service',
        name: 'service',
        meta: { requrieAuth: true },
        component: () => import('../views/servicesManagement/allServices.vue'),
        // children: [
        //   {
        //     path: 'all',
        //     name: 'allServices',
        //     meta: { requrieAuth: true },
        //     component: () => import('../views/servicesManagement/allServices.vue'),
        //   },
        //   {
        //     path: 'installed',
        //     name: 'installed',
        //     meta: { requrieAuth: true },
        //     component: () => import('../views/servicesManagement/allServices.vue'),
        //   },
        //   {
        //     path: 'uninstall',
        //     name: 'uninstall',
        //     meta: { requrieAuth: true },
        //     component: () => import('../views/servicesManagement/allServices.vue'),
        //   }
        // ]
      },
      {
        path: 'security',
        name: 'security',
        meta: { requrieAuth: true },
        redirect: '/home/security/logMonitor',
        component: () => import('../views/securityManagement/index.vue'),
        children: [
          {
            path: 'logMonitor',
            name: 'logMonitor',
            meta: { requrieAuth: true },
            component: () => import('../views/securityManagement/logMonitor.vue'),
          },
          {
            path: 'systemMonitor',
            name: 'systemMonitor',
            meta: { requrieAuth: true },
            component: () => import('../views/securityManagement/systemMonitor/index.vue'),
          },
        ],
      },
    ],
  },
];

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

export default router;
