neon-sprawl/server/NeonSprawl.Server/Game/Contracts/ContractTemplateCatalog.cs

28 lines
1.2 KiB
C#

using System.Collections.ObjectModel;
namespace NeonSprawl.Server.Game.Contracts;
/// <summary>In-memory contract template catalog loaded at startup (NEO-145). Game code should prefer <see cref="IContractTemplateRegistry"/> for lookups.</summary>
public sealed class ContractTemplateCatalog
{
public ContractTemplateCatalog(
string contractsDirectory,
IReadOnlyDictionary<string, ContractTemplateRow> byId,
int catalogJsonFileCount)
{
ContractsDirectory = contractsDirectory;
ById = new ReadOnlyDictionary<string, ContractTemplateRow>(new Dictionary<string, ContractTemplateRow>(byId, StringComparer.Ordinal));
CatalogJsonFileCount = catalogJsonFileCount;
}
/// <summary>Absolute path to the directory that was enumerated for <c>*_contract_templates.json</c> catalogs.</summary>
public string ContractsDirectory { get; }
public IReadOnlyDictionary<string, ContractTemplateRow> ById { get; }
public int DistinctTemplateCount => ById.Count;
/// <summary>Number of <c>*_contract_templates.json</c> files under <see cref="ContractsDirectory"/>.</summary>
public int CatalogJsonFileCount { get; }
}