using System.Collections.ObjectModel; namespace NeonSprawl.Server.Game.Items; /// In-memory item catalog loaded at startup (NEO-51). Game code should prefer for lookups (NEO-52). public sealed class ItemDefinitionCatalog( string itemsDirectory, IReadOnlyDictionary byId, int catalogJsonFileCount) { /// Absolute path to the directory that was enumerated for *_items.json catalogs. public string ItemsDirectory { get; } = itemsDirectory; public IReadOnlyDictionary ById { get; } = new ReadOnlyDictionary(new Dictionary(byId, StringComparer.Ordinal)); public int DistinctItemCount => ById.Count; /// Number of *_items.json files under . public int CatalogJsonFileCount { get; } = catalogJsonFileCount; /// Resolves a catalog row by stable . public bool TryGetItem(string id, out ItemDefRow? row) => ById.TryGetValue(id, out row); }