namespace GFramework.Game.Config;
///
/// 表示单个 YAML 文件中提取出的跨表引用。
/// 该模型保留源文件、字段路径和目标表等诊断信息,以便加载器在批量校验失败时给出可定位的错误。
///
internal sealed class YamlConfigReferenceUsage
{
///
/// 初始化一个跨表引用使用记录。
///
/// 源 YAML 文件路径。
/// 定义该引用的 schema 文件路径。
/// 声明引用的字段路径。
/// YAML 中的原始标量值。
/// 目标配置表名称。
/// 引用值的 schema 标量类型。
public YamlConfigReferenceUsage(
string yamlPath,
string schemaPath,
string propertyPath,
string rawValue,
string referencedTableName,
YamlConfigSchemaPropertyType valueType)
{
ArgumentNullException.ThrowIfNull(yamlPath);
ArgumentNullException.ThrowIfNull(schemaPath);
ArgumentNullException.ThrowIfNull(propertyPath);
ArgumentNullException.ThrowIfNull(rawValue);
ArgumentNullException.ThrowIfNull(referencedTableName);
YamlPath = yamlPath;
SchemaPath = schemaPath;
PropertyPath = propertyPath;
RawValue = rawValue;
ReferencedTableName = referencedTableName;
ValueType = valueType;
}
///
/// 获取源 YAML 文件路径。
///
public string YamlPath { get; }
///
/// 获取定义该引用的 schema 文件路径。
///
public string SchemaPath { get; }
///
/// 获取声明引用的字段路径。
///
public string PropertyPath { get; }
///
/// 获取 YAML 中的原始标量值。
///
public string RawValue { get; }
///
/// 获取目标配置表名称。
///
public string ReferencedTableName { get; }
///
/// 获取引用值的 schema 标量类型。
///
public YamlConfigSchemaPropertyType ValueType { get; }
///
/// 获取便于诊断显示的字段路径。
///
public string DisplayPath => PropertyPath;
}