using System.Collections.ObjectModel;

namespace NeonSprawl.Server.Game.Skills;

/// <summary>In-memory skill catalog loaded at startup (NEO-34). Game code should prefer <see cref="ISkillDefinitionRegistry"/> for lookups (NEO-35).</summary>
public sealed class SkillDefinitionCatalog
{
    public SkillDefinitionCatalog(
        string skillsDirectory,
        IReadOnlyDictionary<string, SkillDefRow> byId,
        int catalogJsonFileCount)
    {
        SkillsDirectory = skillsDirectory;
        ById = new ReadOnlyDictionary<string, SkillDefRow>(new Dictionary<string, SkillDefRow>(byId, StringComparer.Ordinal));
        CatalogJsonFileCount = catalogJsonFileCount;
    }

    /// <summary>Absolute path to the directory that was enumerated for <c>*_skills.json</c> catalogs.</summary>
    public string SkillsDirectory { get; }

    public IReadOnlyDictionary<string, SkillDefRow> ById { get; }

    public int DistinctSkillCount => ById.Count;

    /// <summary>Number of <c>*_skills.json</c> files under <see cref="SkillsDirectory"/>.</summary>
    public int CatalogJsonFileCount { get; }
}
