import type { Route } from '@/global'

const Layout = () => import('@/layouts/index.vue')

const routes: Route.recordRaw[] = [
  {
    path: '/basic/group',
    component: Layout,
    redirect: '/basic/group/list',
    name: 'Group',
    meta: {
      title: '分组管理',
      icon: 'ep:key',
      auth: '/basic/group',
    },
    children: [
      {
        path: 'list',
        name: 'GroupList',
        component: () => import('@/views/basic/group/list.vue'),
        meta: {
          title: '分组管理',
          auth: '/basic/group',
          sidebar: false,
          breadcrumb: true,
          activeMenu: '/basic/group',
        },
      },
      {
        path: 'detail/:id?',
        name: 'GroupInfoDetail',
        component: () => import('@/views/basic/group/detail.vue'),
        meta: {
          title: '分组详情',
          sidebar: false,
          breadcrumb: true,
          activeMenu: '/basic/group',
        },
      },
    ],
  },
  {
    path: '/basic/device',
    component: Layout,
    redirect: '/basic/device/list',
    name: 'Device',
    meta: {
      title: '设备管理',
      icon: 'ep:key',
      auth: '/basic/device',
    },
    children: [
      {
        path: 'list',
        name: 'DeviceList',
        component: () => import('@/views/basic/device/list.vue'),
        meta: {
          title: '设备管理',
          auth: '/basic/device',
          sidebar: false,
          breadcrumb: true,
          activeMenu: '/basic/device',
        },
      },
      {
        path: 'detail/:id?',
        name: 'DeviceInfoDetail',
        component: () => import('@/views/basic/device/detail.vue'),
        meta: {
          title: '设备详情',
          sidebar: false,
          breadcrumb: true,
          activeMenu: '/basic/device',
        },
      },
    ],
  },
  {
    path: '/basic/product',
    component: Layout,
    redirect: '/basic/product/list',
    name: 'Product',
    meta: {
      title: '产品管理',
      icon: 'ep:key',
      auth: '/basic/product',
    },
    children: [
      {
        path: 'list',
        name: 'ProductList',
        component: () => import('@/views/basic/product/list.vue'),
        meta: {
          title: '产品管理',
          auth: '/basic/product',
          sidebar: false,
          breadcrumb: true,
          activeMenu: '/basic/product',
        },
      },
    ],
  },
  {
    path: '/basic/ota',
    component: Layout,
    redirect: '/basic/ota/list',
    name: 'OTA',
    meta: {
      title: '远程升级',
      icon: 'ep:key',
      auth: '/basic/ota',
    },
    children: [
      {
        path: 'list',
        name: 'OTAPackageList',
        component: () => import('@/views/basic/package/index.vue'),
        meta: {
          title: '升级包管理',
          auth: '/basic/ota/list',
          icon: 'ep:key',
        },
      },
      {
        path: 'task',
        name: 'OTATaskList',
        component: () => import('@/views/basic/task/index.vue'),
        meta: {
          title: '远程升级',
          auth: '/basic/ota/task',
          icon: 'ep:key',
        },
      },
    ],
  },
]

export default routes
