# HMS 权限注册表 — 单一真相源
#
# 此文件是权限码的权威来源。所有模块的权限必须在此声明。
# CI 脚本 check-permissions.sh 从此文件验证一致性。
#
# 用法:
#   - 新增权限: 在对应模块下添加条目
#   - 生成 seed: node scripts/gen-permissions.js --seed
#   - 验证一致: bash scripts/check-permissions.sh

auth:
  module: erp-auth
  description: 用户/角色/权限/组织/部门/岗位
  permissions:
    - code: user.list
      name: 查看用户列表
    - code: user.create
      name: 创建用户
    - code: user.read
      name: 查看用户详情
    - code: user.update
      name: 编辑用户
    - code: user.delete
      name: 删除用户
    - code: role.list
      name: 查看角色列表
    - code: role.create
      name: 创建角色
    - code: role.read
      name: 查看角色详情
    - code: role.update
      name: 编辑角色
    - code: role.delete
      name: 删除角色
    - code: permission.list
      name: 查看权限
    - code: organization.list
      name: 查看组织列表
    - code: organization.create
      name: 创建组织
    - code: organization.update
      name: 编辑组织
    - code: organization.delete
      name: 删除组织
    - code: department.list
      name: 查看部门列表
    - code: department.create
      name: 创建部门
    - code: department.update
      name: 编辑部门
    - code: department.delete
      name: 删除部门
    - code: position.list
      name: 查看岗位列表
    - code: position.create
      name: 创建岗位
    - code: position.update
      name: 编辑岗位
    - code: position.delete
      name: 删除岗位

config:
  module: erp-config
  description: 字典/菜单/配置/编号/主题/语言
  permissions:
    - code: dictionary.list
      name: 查看字典
    - code: dictionary.create
      name: 创建字典
    - code: dictionary.update
      name: 编辑字典
    - code: dictionary.delete
      name: 删除字典
    - code: menu.list
      name: 查看菜单
    - code: menu.update
      name: 编辑菜单
    - code: setting.read
      name: 查看配置
    - code: setting.update
      name: 编辑配置
    - code: setting.delete
      name: 删除配置
    - code: numbering.list
      name: 查看编号规则
    - code: numbering.create
      name: 创建编号规则
    - code: numbering.update
      name: 编辑编号规则
    - code: numbering.delete
      name: 删除编号规则
    - code: numbering.generate
      name: 生成编号
    - code: theme.read
      name: 查看主题
    - code: theme.update
      name: 编辑主题
    - code: language.list
      name: 查看语言
    - code: language.update
      name: 编辑语言

workflow:
  module: erp-workflow
  description: 流程定义/审批/委派
  permissions:
    - code: workflow.create
      name: 创建流程
    - code: workflow.list
      name: 查看流程
    - code: workflow.read
      name: 查看流程详情
    - code: workflow.update
      name: 编辑流程
    - code: workflow.publish
      name: 发布流程
    - code: workflow.start
      name: 发起流程
    - code: workflow.approve
      name: 审批任务
    - code: workflow.delegate
      name: 委派任务

message:
  module: erp-message
  description: 消息/模板
  permissions:
    - code: message.list
      name: 查看消息
    - code: message.send
      name: 发送消息
    - code: message.template.list
      name: 查看消息模板
    - code: message.template.create
      name: 创建消息模板
    - code: message.template.manage
      name: 管理消息模板

plugin:
  module: erp-plugin
  description: 插件管理
  permissions:
    - code: plugin.admin
      name: 插件管理
    - code: plugin.list
      name: 查看插件

health:
  module: erp-health
  description: 患者管理/健康数据/预约排班/随访/咨询/告警/设备/积分/内容/媒体
  permissions:
    - code: health.patient.list
      name: 查看患者列表
    - code: health.patient.manage
      name: 管理患者
    - code: health.health-data.list
      name: 查看健康数据
    - code: health.health-data.manage
      name: 管理健康数据
    - code: health.appointment.list
      name: 查看预约
    - code: health.appointment.manage
      name: 管理预约
    - code: health.follow-up.list
      name: 查看随访
    - code: health.follow-up.manage
      name: 管理随访
    - code: health.consultation.list
      name: 查看咨询
    - code: health.consultation.manage
      name: 管理咨询
    - code: health.doctor.list
      name: 查看医护
    - code: health.doctor.manage
      name: 管理医护
    - code: health.articles.list
      name: 查看资讯
    - code: health.articles.manage
      name: 管理资讯
    - code: health.articles.review
      name: 审核资讯
    - code: health.points.list
      name: 查看积分
    - code: health.points.manage
      name: 管理积分
    - code: health.device-readings.list
      name: 查看设备数据
    - code: health.device-readings.manage
      name: 管理设备数据
    - code: health.devices.list
      name: 查看设备绑定
    - code: health.devices.manage
      name: 管理设备绑定
    - code: health.alerts.list
      name: 查看告警
    - code: health.alerts.manage
      name: 管理告警
    - code: health.alert-rules.list
      name: 查看告警规则
    - code: health.alert-rules.manage
      name: 管理告警规则
    - code: health.critical-alerts.list
      name: 查看危急值告警
    - code: health.critical-alerts.manage
      name: 处理危急值告警
    - code: health.critical-value-thresholds.list
      name: 查看危急值阈值
    - code: health.critical-value-thresholds.manage
      name: 管理危急值阈值
    - code: health.follow-up-templates.list
      name: 查看随访模板
    - code: health.follow-up-templates.manage
      name: 管理随访模板
    - code: health.daily-monitoring.list
      name: 查看日常监测
    - code: health.daily-monitoring.manage
      name: 管理日常监测
    - code: health.consent.list
      name: 查看知情同意
    - code: health.consent.manage
      name: 管理知情同意
    - code: health.medication-records.list
      name: 查看用药记录
    - code: health.medication-records.manage
      name: 管理用药记录
    - code: health.medication-reminders.list
      name: 查看药物提醒
    - code: health.medication-reminders.manage
      name: 管理药物提醒
    - code: health.action-inbox.list
      name: 查看行动收件箱
    - code: health.action-inbox.manage
      name: 管理行动项
    - code: health.action-inbox.team
      name: 查看团队概览
    - code: health.dashboard.manage
      name: 工作台管理
    - code: health.oauth.list
      name: 查看合作方
    - code: health.oauth.manage
      name: 管理合作方
    - code: health.care-plan.list
      name: 查看护理计划
      frozen: true
    - code: health.care-plan.manage
      name: 管理护理计划
      frozen: true
    - code: health.shifts.list
      name: 查看班次
      frozen: true
    - code: health.shifts.manage
      name: 管理班次
      frozen: true
    - code: health.ble-gateways.list
      name: 查看 BLE 网关
    - code: health.ble-gateways.manage
      name: 管理 BLE 网关
    - code: health.family-proxy.list
      name: 查看家庭健康代理
      frozen: true
    - code: health.family-proxy.manage
      name: 管理家庭健康代理
      frozen: true
    - code: health.media.list
      name: 查看媒体库
    - code: health.media.manage
      name: 管理媒体库
    - code: health.banners.list
      name: 查看轮播图
    - code: health.banners.manage
      name: 管理轮播图

ai:
  module: erp-ai
  description: AI 分析/Prompt/Copilot
  permissions:
    - code: ai.analysis.list
      name: 查看分析历史
    - code: ai.analysis.manage
      name: 请求分析
    - code: ai.prompt.list
      name: 查看 Prompt
    - code: ai.prompt.manage
      name: 管理 Prompt
    - code: ai.usage.list
      name: 查看用量
    - code: ai.provider.manage
      name: 管理提供商
    - code: ai.suggestion.list
      name: 查看 AI 建议
    - code: ai.suggestion.manage
      name: 审批 AI 建议
    - code: copilot.insights.list
      name: 查看 Copilot 洞察
    - code: copilot.insights.manage
      name: 管理 Copilot 洞察
    - code: copilot.risk.view
      name: 查看风险评分
    - code: copilot.rules.list
      name: 查看 Copilot 规则
    - code: copilot.rules.manage
      name: 管理 Copilot 规则

dialysis:
  module: erp-dialysis
  description: 透析管理
  permissions:
    - code: health.dialysis.list
      name: 查看透析记录
    - code: health.dialysis.manage
      name: 管理透析记录
    - code: health.dialysis-prescription.list
      name: 查看透析处方
    - code: health.dialysis-prescription.manage
      name: 管理透析处方
    - code: health.dialysis.stats
      name: 查看透析统计
