using System.Diagnostics.CodeAnalysis;

namespace NeonSprawl.Server.Game.Items;

/// <summary>
/// Read-only access to validated <see cref="ItemDefRow"/> entries loaded at startup (<see cref="ItemDefinitionCatalog"/>).
/// </summary>
/// <remarks>
/// <para><b>E3.M3 (inventory / craft / gather):</b> callers granting or validating items should depend on this interface
/// rather than <see cref="ItemDefinitionCatalog"/> so stack limits and slot kinds stay centralized.</para>
/// <para><b>NEO-53:</b> HTTP/read-model projections should depend on this interface rather than reaching into the catalog.</para>
/// </remarks>
public interface IItemDefinitionRegistry
{
    /// <summary>Attempts to resolve an item by stable <c>id</c> (see <c>item-def.schema.json</c>). Unknown ids and <c>null</c> return <c>false</c> without throwing.</summary>
    bool TryGetDefinition(string? itemId, [NotNullWhen(true)] out ItemDefRow? definition);

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