import Vue from 'vue'
import Router from 'vue-router'

Vue.use(Router)

export default new Router({
  routes: [
    {
      path: '/',
      redirect:'/login',
    },
    {
      path: '/login',
      component: function(resolve){
        require(['../views/Login.vue'],resolve);
      }
    },
    {
      path: '/monitor',
      redirect: '/monitor/home',
      component: function(resolve){
        require(['../views/container.vue'],resolve);
      },
      children:
        [
          {
            path: '/monitor/account',
            component: function(resolve){
              require(['../views/account.vue'],resolve);
            },
          },
          {
            path:"/monitor/:name",
            component: function(resolve){
              require(['../views/RobotContainer.vue'],resolve);
            },
            children: [
              {
                path: '/',
                component: function(resolve){
                  require(['../views/overview.vue'],resolve);
                },
              },
              {
                path: 'RobotDetail',
                component: function(resolve){
                  require(['../views/RobotDetails.vue'],resolve);
                },
              },

            ]
          }
        ]
    },
    {
      path: '*',
      redirect:'/monitor/account',
    }
  ]
})
