namespace Admin.NET.Plugin.AiDOP.Const.S8;
///
/// S8 权限点条目(Catalog 真源,不依赖数据库)。
///
public sealed class S8PermissionItem
{
public string Code { get; init; } = string.Empty;
public string Label { get; init; } = string.Empty;
public string Group { get; init; } = string.Empty;
public int SortNo { get; init; }
///
/// S8-P0-4-API-AUTHORIZATION-1:已废弃的历史能力码。
/// 不删除、不从种子移除 —— 对应 SysMenu 行与 SysRoleMenu 授权已存在于各环境,
/// 删除属破坏性数据变更。标记后:目录仍列出(便于运维识别),但**任何 Action 都不得引用**,
/// 由 S8AuthorizationGuardTests 强制。
///
public bool Deprecated { get; init; }
}
///
/// S8 权限点目录(B0 阶段静态 catalog;后续 B2 矩阵 / B3 v-auth / B4 后端兜底统一从此读取)。
/// 命名规范:s8:<resource>:<action>
///
public static class S8PermissionCatalog
{
public const string GroupException = "exception";
public const string GroupVerification = "verification";
public const string GroupConfig = "config";
public const string GroupDashboard = "dashboard";
public const string GroupDebug = "debug";
// ───────── S8-P0-4-API-AUTHORIZATION-1:capability 级权限码常量 ─────────
// 只在此处声明字面量;Controller 一律引用常量,杜绝手写字符串拼错导致「声明了但永远匹配不到」。
public const string ExceptionRead = "s8:exception:read";
public const string ExceptionCreate = "s8:exception:create";
public const string ExceptionAssign = "s8:exception:assign";
public const string ExceptionClaim = "s8:exception:claim";
public const string ExceptionStart = "s8:exception:start";
public const string ExceptionReject = "s8:exception:reject";
public const string ExceptionUpgrade = "s8:exception:upgrade";
public const string ExceptionClose = "s8:exception:close";
public const string ExceptionComment = "s8:exception:comment";
public const string VerificationSubmit = "s8:verification:submit";
public const string VerificationApprove = "s8:verification:approve";
public const string VerificationReject = "s8:verification:reject";
public const string ConfigRead = "s8:config:read";
public const string ConfigOperatorBind = "s8:config:operator:bind";
public const string ConfigRoleWrite = "s8:config:role:write";
public const string ConfigWatchRule = "s8:config:watch-rule";
public const string ConfigDataSource = "s8:config:data-source";
public const string ConfigExceptionType = "s8:config:exception-type";
public const string ConfigNotification = "s8:config:notification";
public const string ConfigScene = "s8:config:scene";
public const string ConfigKpi = "s8:config:kpi";
public const string ConfigDashboard = "s8:config:dashboard";
public const string DashboardRead = "s8:dashboard:read";
public const string DebugRun = "s8:debug:run";
private static readonly IReadOnlyList _all = new List
{
new() { Code = "s8:exception:read", Label = "查看异常", Group = GroupException, SortNo = 10 },
new() { Code = "s8:exception:create", Label = "主动提报", Group = GroupException, SortNo = 20 },
new() { Code = "s8:exception:assign", Label = "分派异常", Group = GroupException, SortNo = 30 },
new() { Code = "s8:exception:claim", Label = "认领异常", Group = GroupException, SortNo = 40 },
new() { Code = "s8:exception:start", Label = "开始处理", Group = GroupException, SortNo = 50 },
new() { Code = "s8:exception:reject", Label = "驳回异常", Group = GroupException, SortNo = 60 },
new() { Code = "s8:exception:upgrade", Label = "升级异常", Group = GroupException, SortNo = 70 },
// S8-P0-4:S8 没有独立「关闭异常」接口 —— 关闭是 approve-verification 走状态机
// PENDING_VERIFICATION → CLOSED 的结果(S8StatusRules 无 CLOSE 动作)。
// 该码自始无对应 Action,标记为 deprecated;既有 SysMenu 行与授权保持不动。
new() { Code = "s8:exception:close", Label = "关闭异常", Group = GroupException, SortNo = 80, Deprecated = true },
new() { Code = "s8:verification:submit", Label = "提交复检", Group = GroupVerification, SortNo = 110 },
new() { Code = "s8:verification:approve", Label = "检验通过", Group = GroupVerification, SortNo = 120 },
new() { Code = "s8:verification:reject", Label = "检验退回", Group = GroupVerification, SortNo = 130 },
new() { Code = "s8:exception:comment", Label = "补充说明", Group = GroupException, SortNo = 90 },
new() { Code = "s8:config:read", Label = "查看配置", Group = GroupConfig, SortNo = 210 },
new() { Code = "s8:config:operator:bind", Label = "维护操作员绑定", Group = GroupConfig, SortNo = 220 },
new() { Code = "s8:config:role:write", Label = "维护角色权限", Group = GroupConfig, SortNo = 230 },
new() { Code = "s8:config:watch-rule", Label = "维护监控规则", Group = GroupConfig, SortNo = 240 },
new() { Code = "s8:config:data-source", Label = "维护数据源", Group = GroupConfig, SortNo = 250 },
new() { Code = "s8:config:exception-type", Label = "维护异常类型", Group = GroupConfig, SortNo = 260 },
new() { Code = "s8:config:notification", Label = "维护通知分层", Group = GroupConfig, SortNo = 270 },
new() { Code = "s8:config:scene", Label = "维护场景配置", Group = GroupConfig, SortNo = 280 },
new() { Code = "s8:config:kpi", Label = "维护KPI目标值", Group = GroupConfig, SortNo = 290 },
new() { Code = "s8:config:dashboard", Label = "维护大屏卡片", Group = GroupConfig, SortNo = 300 },
new() { Code = "s8:dashboard:read", Label = "查看看板", Group = GroupDashboard, SortNo = 310 },
new() { Code = "s8:debug:run", Label = "运维调试接口", Group = GroupDebug, SortNo = 900 },
};
public static IReadOnlyList All => _all;
}