using System.Diagnostics.CodeAnalysis;

namespace NeonSprawl.Server.Game.Combat;

/// <summary>
/// Read-only access to validated <see cref="AbilityDefRow"/> entries loaded at startup (<see cref="AbilityDefinitionCatalog"/>).
/// </summary>
/// <remarks>
/// <para><b>E5.M1 (combat / hotbar / cast):</b> callers validating ability ids and resolving damage/cooldown metadata should depend on this interface
/// rather than <see cref="AbilityDefinitionCatalog"/> so ability defs stay centralized.</para>
/// <para><b>NEO-78:</b> HTTP/read-model projections should depend on this interface rather than reaching into the catalog.</para>
/// </remarks>
public interface IAbilityDefinitionRegistry
{
    /// <summary>Attempts to resolve an ability by stable <c>id</c> (see <c>ability-def.schema.json</c>). Unknown ids and <c>null</c> return <c>false</c> without throwing.</summary>
    bool TryGetDefinition(string? abilityId, [NotNullWhen(true)] out AbilityDefRow? definition);

    /// <summary>Trims and lowercases <paramref name="rawAbilityId"/>; returns <c>true</c> when the normalized id exists in the loaded catalog. <c>null</c>, empty, and whitespace return <c>false</c> without throwing.</summary>
    bool TryNormalizeKnown(string? rawAbilityId, [NotNullWhen(true)] out string normalized);

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