//
#nullable enable
namespace GFramework.Game.Config.Generated;
///
/// Auto-generated registration and lookup helpers for schema file 'monster.schema.json'.
/// The helper centralizes table naming, config directory, schema path, and strong-typed registry access so consumer projects do not need to duplicate the same conventions.
///
public static class MonsterConfigBindings
{
///
/// Gets the runtime registration name of the generated config table.
///
public const string TableName = "monster";
///
/// Gets the config directory path expected by the generated registration helper.
///
public const string ConfigRelativePath = "monster";
///
/// Gets the schema file path expected by the generated registration helper.
///
public const string SchemaRelativePath = "schemas/monster.schema.json";
///
/// Registers the generated config table using the schema-derived runtime conventions.
///
/// The target YAML config loader.
/// Optional key comparer for the generated table registration.
/// The same loader instance so registration can keep chaining.
public static global::GFramework.Game.Config.YamlConfigLoader RegisterMonsterTable(
this global::GFramework.Game.Config.YamlConfigLoader loader,
global::System.Collections.Generic.IEqualityComparer? comparer = null)
{
if (loader is null)
{
throw new global::System.ArgumentNullException(nameof(loader));
}
return loader.RegisterTable(
TableName,
ConfigRelativePath,
SchemaRelativePath,
static config => config.Id,
comparer);
}
///
/// Gets the generated config table wrapper from the registry.
///
/// The source config registry.
/// The generated strong-typed table wrapper.
/// When is null.
public static MonsterTable GetMonsterTable(this global::GFramework.Game.Abstractions.Config.IConfigRegistry registry)
{
if (registry is null)
{
throw new global::System.ArgumentNullException(nameof(registry));
}
return new MonsterTable(registry.GetTable(TableName));
}
///
/// Tries to get the generated config table wrapper from the registry.
///
/// The source config registry.
/// The generated strong-typed table wrapper when lookup succeeds; otherwise null.
/// True when the generated table is registered and type-compatible; otherwise false.
/// When is null.
public static bool TryGetMonsterTable(this global::GFramework.Game.Abstractions.Config.IConfigRegistry registry, out MonsterTable? table)
{
if (registry is null)
{
throw new global::System.ArgumentNullException(nameof(registry));
}
if (registry.TryGetTable(TableName, out var innerTable) && innerTable is not null)
{
table = new MonsterTable(innerTable);
return true;
}
table = null;
return false;
}
}