using System.Text.Json.Serialization;

namespace NeonSprawl.Server.Game.Items;

/// <summary>JSON body for <c>GET /game/world/item-definitions</c> (NEO-53).</summary>
public sealed class ItemDefinitionsListResponse
{
    public const int CurrentSchemaVersion = 1;

    [JsonPropertyName("schemaVersion")]
    public int SchemaVersion { get; init; } = CurrentSchemaVersion;

    /// <summary>Loaded items ordered by stable <c>id</c> (ordinal), matching <see cref="IItemDefinitionRegistry.GetDefinitionsInIdOrder"/>.</summary>
    [JsonPropertyName("items")]
    public required IReadOnlyList<ItemDefinitionJson> Items { get; init; }
}

/// <summary>One row in the read-only item definition projection.</summary>
public sealed class ItemDefinitionJson
{
    [JsonPropertyName("id")]
    public required string Id { get; init; }

    [JsonPropertyName("displayName")]
    public required string DisplayName { get; init; }

    [JsonPropertyName("prototypeRole")]
    public required string PrototypeRole { get; init; }

    [JsonPropertyName("stackMax")]
    public required int StackMax { get; init; }

    [JsonPropertyName("inventorySlotKind")]
    public required string InventorySlotKind { get; init; }
}
