import { RouteRecordRaw } from 'vue-router';
import { Layout } from '@/router/constant';
import { OptionsSharp } from '@vicons/ionicons5';
import { renderIcon } from '@/utils/index';

/**
 * @param name 路由名称, 必须设置,且不能重名
 * @param meta 路由元信息（路由附带扩展信息）
 * @param redirect 重定向地址, 访问这个路由时,自定进行重定向
 * @param meta.disabled 禁用整个菜单
 * @param meta.title 菜单名称
 * @param meta.icon 菜单图标
 * @param meta.keepAlive 缓存该路由
 * @param meta.sort 排序越小越排前
 *
 * */
const routes: Array<RouteRecordRaw> = [
  {
    path: '/system',
    name: 'System',
    redirect: '/system/menu',
    component: Layout,
    meta: {
      title: '系统管理',
      icon: renderIcon(OptionsSharp),
      sort: 1,
    },
    children: [
      {
        path: 'online',
        name: 'online',
        meta: {
          title: '在线用户',
        },
        component: () => import('@/views/system/online/online.vue'),
      },
      {
        path: 'tenant',
        name: 'system_tenant',
        meta: {
          title: '租户管理',
        },
        component: () => import('@/views/system/tenant/tenant.vue'),
      },
      {
        path: 'menu',
        name: 'system_menu',
        meta: {
          title: '菜单管理',
        },
        component: () => import('@/views/system/menu/menu.vue'),
      },
      {
        path: 'tenant',
        name: 'system_tenant',
        meta: {
          title: '租户管理',
        },
        component: () => import('@/views/system/tenant/tenant.vue'),
      },
      {
        path: 'dictionary',
        name: 'system_dictionary',
        meta: {
          title: '字典管理',
        },
        component: () => import('@/views/system/dictionary/dictionary.vue'),
      },
      {
        path: 'logs',
        name: 'system_logs',
        meta: {
          title: '日志管理',
        },
        component: () => import('@/views/system/logs/operlog.vue'),
      },
      {
        path: 'region',
        name: 'system_region',
        meta: {
          title: '区域管理',
        },
        component: () => import('@/views/system/region/region.vue'),
      },
      {
        path: 'config',
        name: 'system_config',
        meta: {
          title: '配置管理',
        },
        component: () => import('@/views/system/config/list.vue'),
      },
      {
        path: 'tasks',
        name: 'system_tasks',
        meta: {
          title: '定时任务管理',
        },
        component: () => import('@/views/system/tasks/list.vue'),
      },
    ],
  },
];

export default routes;
