// #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 strongly-typed registry access so consumer projects do not need to duplicate the same conventions. /// public static class MonsterConfigBindings { /// /// Groups the schema-derived metadata constants so consumer code can reuse one stable entry point. /// public static class Metadata { /// /// Gets the logical config domain derived from the schema base name. The current runtime convention keeps this value aligned with the generated table name. /// public const string ConfigDomain = "monster"; /// /// 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"; } /// /// Gets the logical config domain derived from the schema base name. The current runtime convention keeps this value aligned with the generated table name. /// public const string ConfigDomain = Metadata.ConfigDomain; /// /// Gets the runtime registration name of the generated config table. /// public const string TableName = Metadata.TableName; /// /// Gets the config directory path expected by the generated registration helper. /// public const string ConfigRelativePath = Metadata.ConfigRelativePath; /// /// Gets the schema file path expected by the generated registration helper. /// public const string SchemaRelativePath = Metadata.SchemaRelativePath; /// /// 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( Metadata.TableName, Metadata.ConfigRelativePath, Metadata.SchemaRelativePath, static config => config.Id, comparer); } /// /// Gets the generated config table wrapper from the registry. /// /// The source config registry. /// The generated strongly-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(Metadata.TableName)); } /// /// Tries to get the generated config table wrapper from the registry. /// /// The source config registry. /// The generated strongly-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(Metadata.TableName, out var innerTable) && innerTable is not null) { table = new MonsterTable(innerTable); return true; } table = null; return false; } }