import type { RouteRecordRaw } from 'vue-router';

const moduleName = 'user';

const routes: Array<RouteRecordRaw> = [
  {
    path: '/user',
    name: moduleName,
    redirect: '/user/list',
    meta: {
      title: '用户管理',
      icon: 'ant-design:user-outlined',
    },
    children: [
      {
        path: 'list',
        name: `${moduleName}-list`,
        meta: {
          title: '用户列表',
          icon: 'ant-design:unordered-list-outlined',
          keepAlive: true,
          hideInMenu: false,
        },
        component: () => import('@/views/user/list.vue'),
      },
      {
        path: 'add',
        name: `${moduleName}-add`,
        meta: {
          title: '新增用户',
          icon: 'ant-design:user-add-outlined',
          hideInMenu: true,
          activeMenu: `${moduleName}-list`,
        },
        component: () => import('@/views/user/add.vue'),
      },
      {
        path: 'edit/:id',
        name: `${moduleName}-edit`,
        meta: {
          title: '编辑用户',
          icon: 'ant-design:edit-outlined',
          hideInMenu: true,
          activeMenu: `${moduleName}-list`,
        },
        component: () => import('@/views/user/edit.vue'),
      },
      {
        path: 'detail/:id',
        name: `${moduleName}-detail`,
        meta: {
          title: '用户详情',
          icon: 'ant-design:profile-outlined',
          hideInMenu: true,
          activeMenu: `${moduleName}-list`,
        },
        component: () => import('@/views/user/detail.vue'),
      },
      {
        path: 'change-password/:id',
        name: `${moduleName}-change-password`,
        meta: {
          title: '修改密码',
          icon: 'ant-design:lock-outlined',
          hideInMenu: true,
          activeMenu: `${moduleName}-list`,
        },
        component: () => import('@/views/user/change-password.vue'),
      },
    ],
  },
];

export default routes;
