namespace FoodLabeling.Application.Contracts.Constants;
///
/// 角色「访问权限」勾选项编码(与前端约定一致,存库为 JSON 数组字符串)。
///
public static class RoleAccessPermissionCodes
{
public const string ManageLabels = "manage_labels";
public const string ManagePeople = "manage_people";
public const string EditSettings = "edit_settings";
public const string ManageProducts = "manage_products";
public const string ViewReports = "view_reports";
public const string ApproveBatches = "approve_batches";
/// 全部合法编码(顺序即 UI 展示顺序)
public static readonly IReadOnlyList All = new[]
{
ManageLabels,
ManagePeople,
EditSettings,
ManageProducts,
ViewReports,
ApproveBatches
};
private static readonly HashSet _allSet = new(All, StringComparer.Ordinal);
public static bool IsKnown(string code) => !string.IsNullOrWhiteSpace(code) && _allSet.Contains(code.Trim());
}