import type { ModuleDescriptor } from '@/types/system'

export const moduleCatalog: Record<string, ModuleDescriptor> = {
  dashboard: {
    name: 'dashboard',
    title: '仪表盘',
    group: '总览',
    status: 'ready',
    summary: '展示系统结构、路由覆盖情况和后端模块分布。',
    features: ['菜单覆盖总览', 'API 分组概览', '已重构模块状态', '快捷入口'],
    endpoints: ['/menu/getMenu', '/user/getUserInfo', '/system/getServerInfo'],
  },
  about: {
    name: 'about',
    title: '关于系统',
    group: '总览',
    status: 'partial',
    summary: '用于展示项目来源、版本背景和运维提示。',
    features: ['项目说明', '技术栈梳理', '外部链接入口'],
    endpoints: [],
  },
  superAdmin: {
    name: 'superAdmin',
    title: '超级管理员',
    group: '平台治理',
    status: 'partial',
    summary: '聚合用户、角色、菜单、接口、字典和参数等平台治理功能。',
    features: ['权限治理', '配置管理', '审计日志', 'Token 管理'],
    endpoints: ['/authority/getAuthorityList', '/menu/getBaseMenuTree', '/api/getApiList'],
  },
  authority: {
    name: 'authority',
    title: '角色管理',
    group: '平台治理',
    status: 'ready',
    summary: '管理角色树、默认首页、菜单权限、API 权限和角色用户关系。',
    features: ['角色树', '菜单授权', 'API 授权', '角色分配用户'],
    endpoints: ['/authority/getAuthorityList', '/menu/addMenuAuthority', '/casbin/updateCasbin', '/authority/setRoleUsers'],
  },
  menu: {
    name: 'menu',
    title: '菜单管理',
    group: '平台治理',
    status: 'ready',
    summary: '维护后台菜单树、路由属性、按钮定义和角色关联。',
    features: ['菜单树编辑', '路由路径维护', '角色分配', '按钮权限入口'],
    endpoints: ['/menu/getBaseMenuTree', '/menu/addBaseMenu', '/menu/updateBaseMenu', '/menu/setMenuRoles'],
  },
  api: {
    name: 'api',
    title: 'API 管理',
    group: '平台治理',
    status: 'ready',
    summary: '管理接口目录、接口角色授权和 Casbin 刷新。',
    features: ['接口列表', '接口增删改', '角色授权', '接口分组'],
    endpoints: ['/api/getApiList', '/api/createApi', '/api/updateApi', '/api/setApiRoles'],
  },
  user: {
    name: 'user',
    title: '用户管理',
    group: '平台治理',
    status: 'ready',
    summary: '管理账号、启停状态、角色集合、密码和头像等资料。',
    features: ['用户列表', '新建用户', '重置密码', '角色切换'],
    endpoints: ['/user/getUserList', '/user/admin_register', '/user/setUserInfo', '/user/resetPassword'],
  },
  dictionary: {
    name: 'dictionary',
    title: '字典管理',
    group: '平台治理',
    status: 'ready',
    summary: '管理字典主表与树形字典项，支持导入导出。',
    features: ['字典列表', '树形详情', '导入导出', '状态控制'],
    endpoints: ['/sysDictionary/getSysDictionaryList', '/sysDictionary/exportSysDictionary', '/sysDictionaryDetail/getDictionaryTreeList'],
  },
  operation: {
    name: 'operation',
    title: '操作历史',
    group: '审计',
    status: 'ready',
    summary: '查看系统请求日志、响应体和异常信息。',
    features: ['操作审计', '请求明细', '批量删除'],
    endpoints: ['/sysOperationRecord/getSysOperationRecordList', '/sysOperationRecord/deleteSysOperationRecordByIds'],
  },
  sysParams: {
    name: 'sysParams',
    title: '参数管理',
    group: '平台治理',
    status: 'ready',
    summary: '管理运行期参数键值，供前后端按键读取。',
    features: ['参数列表', '键值维护', '说明管理'],
    endpoints: ['/sysParams/getSysParamsList', '/sysParams/createSysParams', '/sysParams/updateSysParams'],
  },
  system: {
    name: 'system',
    title: '系统配置',
    group: '运维',
    status: 'ready',
    summary: '编辑服务配置文件并触发系统重载。',
    features: ['配置读取', '配置保存', '服务重载'],
    endpoints: ['/system/getSystemConfig', '/system/setSystemConfig', '/system/reloadSystem'],
  },
  apiToken: {
    name: 'apiToken',
    title: 'API Token',
    group: '运维',
    status: 'ready',
    summary: '为用户签发临时 JWT，并追踪失效状态和过期时间。',
    features: ['Token 列表', '签发 Token', '作废 Token'],
    endpoints: ['/sysApiToken/getApiTokenList', '/sysApiToken/createApiToken', '/sysApiToken/deleteApiToken'],
  },
  loginLog: {
    name: 'loginLog',
    title: '登录日志',
    group: '审计',
    status: 'ready',
    summary: '审计登录成功与失败事件，定位登录问题。',
    features: ['登录结果', '失败原因', '设备信息'],
    endpoints: ['/sysLoginLog/getLoginLogList', '/sysLoginLog/deleteLoginLogByIds'],
  },
  sysVersion: {
    name: 'sysVersion',
    title: '版本管理',
    group: '运维',
    status: 'partial',
    summary: '围绕版本导出、导入和回滚的发布管理模块。',
    features: ['版本列表', '版本导出', '版本同步'],
    endpoints: ['/sysVersion/getSysVersionList', '/sysVersion/exportVersion', '/sysVersion/importVersion'],
  },
  sysError: {
    name: 'sysError',
    title: '错误日志',
    group: '审计',
    status: 'ready',
    summary: '管理系统错误记录和 AI 处理状态。',
    features: ['错误列表', '状态流转', 'AI 处理触发'],
    endpoints: ['/sysError/getSysErrorList', '/sysError/getSysErrorSolution', '/sysError/updateSysError'],
  },
  common: {
    name: 'common',
    title: '公共能力',
    group: '公共模块',
    status: 'partial',
    summary: '承载多端复用的公共功能，不再挂在示例目录下。',
    features: ['公共上传能力', '后续 app 复用入口'],
    endpoints: ['/fileUploadAndDownload/getFileList', '/attachmentCategory/getCategoryList'],
  },
  example: {
    name: 'example',
    title: '示例文件',
    group: '业务示例',
    status: 'partial',
    summary: '保留和业务演示直接相关的示例页面。',
    features: ['断点续传', '客户资源示例'],
    endpoints: ['/customer/customerList'],
  },
  upload: {
    name: 'upload',
    title: '媒体库',
    group: '公共模块',
    status: 'partial',
    summary: '管理上传文件和资源分类，后续可直接复用到 app 模块。',
    features: ['文件列表', '文件上传', '分类管理'],
    endpoints: ['/fileUploadAndDownload/getFileList', '/attachmentCategory/getCategoryList'],
  },
  breakpoint: {
    name: 'breakpoint',
    title: '断点续传',
    group: '业务示例',
    status: 'partial',
    summary: '展示大文件切片上传流程。',
    features: ['文件校验', '分片上传', '合并完成'],
    endpoints: ['/fileUploadAndDownload/findFile', '/fileUploadAndDownload/breakpointContinue'],
  },
  customer: {
    name: 'customer',
    title: '客户列表',
    group: '业务示例',
    status: 'partial',
    summary: '示例业务资源表，用于展示普通 CRUD 模式。',
    features: ['客户列表', '增删改查'],
    endpoints: ['/customer/customerList', '/customer/customer'],
  },
  systemTools: {
    name: 'systemTools',
    title: '编程辅助',
    group: '研发辅助',
    status: 'partial',
    summary: '聚合代码生成、模板配置、技能管理和 AI 工作流。',
    features: ['代码生成器', '模板配置', 'Skills 管理', 'AI 页面绘制'],
    endpoints: ['/autoCode/getDB', '/skills/getSkillList'],
  },
  autoPkg: {
    name: 'autoPkg',
    title: '模板配置',
    group: '研发辅助',
    status: 'partial',
    summary: '维护自动代码生成模板。',
    features: ['模板列表', '模板文件'],
    endpoints: ['/autoCode/createPackage', '/autoCode/getPackage', '/autoCode/getTemplates'],
  },
  autoCode: {
    name: 'autoCode',
    title: '代码生成器',
    group: '研发辅助',
    status: 'partial',
    summary: '自动生成表单、接口、服务和路由代码。',
    features: ['库表发现', '代码预览', '代码生成'],
    endpoints: ['/autoCode/getDB', '/autoCode/getTables', '/autoCode/preview', '/autoCode/createTemp'],
  },
  autoCodeAdmin: {
    name: 'autoCodeAdmin',
    title: '自动化代码管理',
    group: '研发辅助',
    status: 'partial',
    summary: '管理自动化代码任务和函数模板。',
    features: ['任务管理', '模板方法'],
    endpoints: ['/autoCode/getMeta', '/autoCode/addFunc'],
  },
  formCreate: {
    name: 'formCreate',
    title: '表单生成器',
    group: '研发辅助',
    status: 'partial',
    summary: '拖拽式表单构建入口。',
    features: ['表单设计'],
    endpoints: [],
  },
  aiWorkflow: {
    name: 'aiWorkflow',
    title: 'AI 需求工作流',
    group: '研发辅助',
    status: 'partial',
    summary: '管理 AI 会话和需求工作流结果。',
    features: ['会话列表', '会话详情', 'Markdown 落盘'],
    endpoints: ['/autoCode/getAIWorkflowSessionList', '/autoCode/getAIWorkflowSessionDetail'],
  },
  exportTemplate: {
    name: 'exportTemplate',
    title: '导出模板',
    group: '研发辅助',
    status: 'partial',
    summary: '维护 Excel 导入导出模板。',
    features: ['模板管理', 'SQL 预览'],
    endpoints: ['/sysExportTemplate/getSysExportTemplateList', '/sysExportTemplate/previewSQL'],
  },
  mcpTest: {
    name: 'mcpTest',
    title: 'Mcp Tools 管理',
    group: '研发辅助',
    status: 'partial',
    summary: '围绕 MCP Tool 的状态、测试和服务控制。',
    features: ['服务状态', '测试调用'],
    endpoints: ['/autoCode/mcpStatus', '/autoCode/mcpTest', '/autoCode/mcpList'],
  },
  mcpTool: {
    name: 'mcpTool',
    title: 'Mcp Tools 模板',
    group: '研发辅助',
    status: 'partial',
    summary: '生成 MCP Tool 模板代码。',
    features: ['模板生成'],
    endpoints: ['/autoCode/mcp'],
  },
  skills: {
    name: 'skills',
    title: 'Skills 管理',
    group: '研发辅助',
    status: 'partial',
    summary: '管理技能定义、脚本、资源、模板和全局约束。',
    features: ['技能列表', '脚本资源管理', '技能打包'],
    endpoints: ['/skills/getSkillList', '/skills/saveSkill', '/skills/packageSkill'],
  },
  picture: {
    name: 'picture',
    title: 'AI 页面绘制',
    group: '研发辅助',
    status: 'partial',
    summary: '基于 AI 描述生成页面草图。',
    features: ['图像工作台'],
    endpoints: ['/autoCode/llmAuto'],
  },
  person: {
    name: 'person',
    title: '个人中心',
    group: '个人',
    status: 'ready',
    summary: '维护当前登录人的资料与密码。',
    features: ['资料更新', '密码修改'],
    endpoints: ['/user/setSelfInfo', '/user/changePassword'],
  },
  state: {
    name: 'state',
    title: '服务器状态',
    group: '运维',
    status: 'ready',
    summary: '读取后端运行状态与资源信息。',
    features: ['原始状态树', '运行信息'],
    endpoints: ['/system/getServerInfo'],
  },
}

export const moduleList = Object.values(moduleCatalog)
