
const routes = [
  {
    path: '/login',
    component: () => import('layouts/LoginLayout.vue'),
    children: [
      {
        name: 'login',
        path: '/login/:email?',
        component: () => import('pages/Login/Login.vue')
      }, {
        name: 'register',
        path: '/register',
        component: () => import('pages/Login/Register.vue')
      }, {
        name: 'rememberPassword',
        path: '/remember-password',
        component: () => import('pages/Login/RememberPassword.vue')
      }, {
        name: 'resetPassword',
        path: '/reset-password',
        component: () => import('pages/Login/ResetPassword.vue')
      }
    ]
  }, {
    path: '/',
    component: () => import('layouts/MainLayout.vue'),
    children: [
      {
        name: '',
        path: '',
        component: () => import('pages/Cms/Home.vue')
      }, {
        name: 'home',
        path: '/home',
        component: () => import('pages/Cms/Home.vue')
      }, {
        name: 'catalog',
        path: '/catalog/:category?/:type?',
        component: () => import('pages/Webshop/Catalog.vue')
      }, {
        name: 'orders',
        path: '/orders',
        component: () => import('pages/Webshop/Orders.vue'),
        children: [
          {
            name: 'pending',
            path: 'pending',
            component: () => import('pages/Webshop/Pending.vue')
          }, {
            name: 'confirmed',
            path: 'confirmed',
            component: () => import('pages/Webshop/Confirmed.vue')
          }
        ]
      }, {
        name: 'order',
        path: '/order/:id',
        component: () => import('pages/Webshop/Pending/View.vue'),
        children: [
          {
            name: '',
            path: '',
            component: () => import('pages/Webshop/Pending/Rows.vue')
          }, {
            name: 'configure',
            path: 'configure',
            component: () => import('pages/Webshop/Pending/Configure.vue')
          }, {
            name: 'checkout',
            path: 'checkout',
            component: () => import('pages/Webshop/Pending/Checkout.vue')
          }
        ]
      }, {
        name: 'ticket',
        path: '/ticket/:id',
        component: () => import('pages/Webshop/Confirmed/View.vue')
      }, {
        name: 'conditions',
        path: '/conditions',
        component: () => import('pages/Cms/Conditions.vue')
      }, {
        name: 'about',
        path: '/about',
        component: () => import('pages/Cms/About.vue')
      }, {
        name: 'admin',
        path: '/admin',
        component: () => import('pages/Admin/Index.vue'),
        children: [
          {
            name: 'panel',
            path: 'panel',
            component: () => import('pages/Admin/Panel.vue')
          }, {
            name: 'users',
            path: 'users',
            component: () => import('pages/Admin/Users.vue')
          }, {
            name: 'connections',
            path: 'connections',
            component: () => import('pages/Admin/Connections.vue')
          }, {
            name: 'visits',
            path: 'visits',
            component: () => import('pages/Admin/Visits.vue')
          }, {
            name: 'news',
            path: 'news',
            component: () => import('pages/Admin/News.vue')
          }, {
            name: 'images',
            path: 'images',
            component: () => import('pages/Admin/Images.vue')
          }, {
            name: 'items',
            path: 'items',
            component: () => import('pages/Admin/Items.vue')
          }
        ]
      }, {
        name: 'accessLog',
        path: '/access-log/:user',
        component: () => import('pages/Admin/AccessLog.vue')
      }, {
        name: 'newEdit',
        path: '/new/:id?',
        component: () => import('pages/Admin/New.vue')
      }, {
        name: 'user',
        path: '/user',
        component: () => import('pages/Account/User.vue'),
        props: route => ({
          changePassword: String(route.query.changePassword) === 'true'
        })
      }, {
        name: 'addresses',
        path: '/addresses',
        component: () => import('pages/Account/Addresses.vue')
      }, {
        name: 'addressEdit',
        path: '/address/:id?',
        component: () => import('pages/Account/Address.vue')
      }
    ]
  }
]

// Always leave this as last one
if (process.env.MODE !== 'ssr') {
  routes.push({
    path: '*',
    component: () => import('pages/Error404.vue')
  })
}

export default routes
