using Admin.NET.Plugin.AiDOP.Entity.S8;
using Admin.NET.Plugin.AiDOP.Service.S8.Rules.Definitions;
namespace Admin.NET.Plugin.AiDOP.Service.S8.Rules;
///
/// S8-RULE-GOVERNANCE-BATCH1:一条规则在本次执行中的**生效形态**
/// —— 代码定义 + 租户运行参数 + 数据库行三者合一。
///
/// 存在的理由是让「语义来自哪里」在类型上就不可混淆:
/// evaluator 拿到的是 与 ,
/// 只用于 Id / RuleCode / 归属列这类**非语义**用途。
/// 谁要是想从 Row.RuleType 取判定类型,一眼就能在 review 里看出来。
///
public sealed class S8EffectiveRule
{
public S8EffectiveRule(AdoS8WatchRule row, S8RuleDefinition definition, S8RuleRuntimeParameters parameters)
{
Row = row;
Definition = definition;
Parameters = parameters;
}
/// 数据库行。仅提供 Id / RuleCode / TenantId / FactoryId 等非语义信息。
public AdoS8WatchRule Row { get; }
/// 代码定义。业务语义的**唯一**真源。
public S8RuleDefinition Definition { get; }
/// 租户运行参数。
public S8RuleRuntimeParameters Parameters { get; }
/// 按行 + 定义解析生效形态。
public static S8EffectiveRule Resolve(AdoS8WatchRule row, S8RuleDefinition definition) =>
new(row, definition, S8RuleRuntimeParameters.Resolve(row, definition));
}