namespace Admin.NET.Plugin.AiDOP.Entity.S8;
///
/// S8 角色权限配置(与系统角色表解耦的配置行;持久化对象)。
///
[SugarTable("ado_s8_role_permission_config", "S8 角色权限配置")]
public class AdoS8RolePermissionConfig
{
[SugarColumn(ColumnName = "id", IsPrimaryKey = true, IsIdentity = true, ColumnDataType = "bigint")]
public long Id { get; set; }
[SugarColumn(ColumnName = "tenant_id", ColumnDataType = "bigint")]
public long TenantId { get; set; }
[SugarColumn(ColumnName = "factory_id", ColumnDataType = "bigint")]
public long FactoryId { get; set; }
[SugarColumn(ColumnName = "role_code", Length = 64)]
public string RoleCode { get; set; } = string.Empty;
[SugarColumn(ColumnName = "permission_codes", Length = 4000, IsNullable = true)]
public string? PermissionCodes { get; set; }
[SugarColumn(ColumnName = "created_at")]
public DateTime CreatedAt { get; set; } = DateTime.Now;
[SugarColumn(ColumnName = "updated_at", IsNullable = true)]
public DateTime? UpdatedAt { get; set; }
///
/// S8-STEP6B-CFG-ROLES-CLOSURE-1:作用域标识(不落库),与 AdoS8ExceptionType / AdoS8DashboardCellConfig 同构。
/// GLOBAL = 平台默认(租户侧只读);FACTORY = 当前工厂覆盖。
/// 前端据此渲染「配置来源」并禁用平台默认行的编辑 / 删除——按 S8ConfigScope 契约,
/// 「不允许在页面上给出最终只会 404 的编辑动作」。
///
[SugarColumn(IsIgnore = true)]
public string Scope => Admin.NET.Plugin.AiDOP.Infrastructure.S8ConfigScope.Resolve(TenantId, FactoryId);
///
/// S8-STEP6B-CFG-ROLES-CLOSURE-1:本行 role_code 是否存在平台默认行(不落库,由 ListAsync 赋值)。
/// true = 平台默认的工厂覆盖;false = 本工厂自建。
///
[SugarColumn(IsIgnore = true)]
public bool HasGlobalDefault { get; set; }
}