using System.Text.Json.Serialization;

namespace NeonSprawl.Server.Game.Skills;

/// <summary>JSON body for <c>GET /game/players/{{id}}/skill-progression</c> (NEO-37).</summary>
public sealed class SkillProgressionSnapshotResponse
{
    public const int CurrentSchemaVersion = 1;

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

    [JsonPropertyName("playerId")]
    public required string PlayerId { get; init; }

    /// <summary>One row per registered skill id. Consumers must treat this as unordered and key rows by <see cref="SkillProgressionRowJson.Id"/> — array order is not part of the public contract.</summary>
    [JsonPropertyName("skills")]
    public required IReadOnlyList<SkillProgressionRowJson> Skills { get; init; }
}

/// <summary>XP and level for one skill before grants (defaults) or after NEO-38 persistence.</summary>
public sealed class SkillProgressionRowJson
{
    [JsonPropertyName("id")]
    public required string Id { get; init; }

    [JsonPropertyName("xp")]
    public int Xp { get; init; }

    [JsonPropertyName("level")]
    public int Level { get; init; }
}
