namespace GFramework.Game.Config;
///
/// 描述一个 YAML 配置表注册项的参数集合。
/// 该选项对象用于替代不断增加的位置参数重载,
/// 让消费者在启用 schema 校验、主键比较器或未来扩展项时仍能保持调用点可读。
///
/// 配置主键类型。
/// 配置值类型。
public sealed class YamlConfigTableRegistrationOptions
where TKey : notnull
{
///
/// 使用最小必需参数创建配置表注册选项。
///
/// 运行时配置表名称。
/// 相对配置根目录的子目录。
/// 配置项主键提取器。
/// 当 为 null 时抛出。
public YamlConfigTableRegistrationOptions(
string tableName,
string relativePath,
Func keySelector)
{
ArgumentNullException.ThrowIfNull(keySelector);
TableName = tableName;
RelativePath = relativePath;
KeySelector = keySelector;
}
///
/// 获取运行时配置表名称。
///
public string TableName { get; }
///
/// 获取相对配置根目录的子目录。
///
public string RelativePath { get; }
///
/// 获取相对配置根目录的 schema 文件路径。
/// 当该值为空时,当前注册项不会启用 schema 校验。
///
public string? SchemaRelativePath { get; init; }
///
/// 获取配置项主键提取器。
///
public Func KeySelector { get; }
///
/// 获取可选的主键比较器。
///
public IEqualityComparer? Comparer { get; init; }
}