using System.Diagnostics.CodeAnalysis;

namespace NeonSprawl.Server.Game.Skills;

/// <summary>
/// Read-only access to validated <see cref="SkillDefRow"/> entries loaded at startup (<see cref="SkillDefinitionCatalog"/>).
/// </summary>
/// <remarks>
/// <para><b>E2.M2 (XP grants):</b> callers issuing skill XP must ensure <c>XpGrantEvent.sourceKind</c> (or successor)
/// is listed on the target skill’s <see cref="SkillDefRow.AllowedXpSourceKinds"/>; the award engine should reject
/// grants outside that set once implemented.</para>
/// <para><b>NEO-36:</b> HTTP/read-model projections should depend on this interface rather than reaching into the catalog.</para>
/// </remarks>
public interface ISkillDefinitionRegistry
{
    /// <summary>Attempts to resolve a skill by stable <c>id</c> (see <c>skill-def.schema.json</c>). Unknown ids and <c>null</c> return <c>false</c> without throwing.</summary>
    bool TryGetDefinition(string? skillId, [NotNullWhen(true)] out SkillDefRow? definition);

    /// <summary>Every loaded definition, ordered by <see cref="SkillDefRow.Id"/> (ordinal).</summary>
    IReadOnlyList<SkillDefRow> GetDefinitionsInIdOrder();
}
