using System.Text.Json.Serialization; namespace NeonSprawl.Server.Game.Items; /// JSON body for GET /game/players/{{id}}/inventory (NEO-55). public sealed class PlayerInventorySnapshotResponse { public const int CurrentSchemaVersion = 1; [JsonPropertyName("schemaVersion")] public int SchemaVersion { get; init; } = CurrentSchemaVersion; [JsonPropertyName("playerId")] public required string PlayerId { get; init; } /// Fixed bag slots 0..23 in ascending order. [JsonPropertyName("bagSlots")] public required IReadOnlyList BagSlots { get; init; } /// Fixed equipment slot index 0. [JsonPropertyName("equipmentSlots")] public required IReadOnlyList EquipmentSlots { get; init; } } /// POST body for inventory add/remove (NEO-55). public sealed class PlayerInventoryMutationRequest { public const int CurrentSchemaVersion = 1; [JsonPropertyName("schemaVersion")] public int SchemaVersion { get; init; } /// Mutation direction: add or remove (ordinal ignore-case). /// add or remove (ordinal ignore-case). [JsonPropertyName("mutationKind")] public required string MutationKind { get; init; } [JsonPropertyName("itemId")] public required string ItemId { get; init; } [JsonPropertyName("quantity")] public int Quantity { get; init; } } /// POST response for inventory mutations — applied or structured deny (NEO-55). public sealed class PlayerInventoryMutationResponse { public const int CurrentSchemaVersion = 1; [JsonPropertyName("schemaVersion")] public int SchemaVersion { get; init; } = CurrentSchemaVersion; [JsonPropertyName("applied")] public bool Applied { get; init; } /// Deny reason when is false; null on success. /// null on success; stable snake_case deny codes from on deny. [JsonPropertyName("reasonCode")] public string? ReasonCode { get; init; } [JsonPropertyName("inventory")] public required PlayerInventorySnapshotResponse Inventory { get; init; } } /// Wire shape for one inventory slot in GET/POST responses. public sealed class InventorySlotStateJson { [JsonPropertyName("slotIndex")] public int SlotIndex { get; init; } /// Omitted when the slot is empty. [JsonPropertyName("itemId")] [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] public string? ItemId { get; init; } [JsonPropertyName("quantity")] public int Quantity { get; init; } }