using System.Text.Json.Serialization;
namespace NeonSprawl.Server.Game.Mastery;
/// JSON body for GET /game/players/{{id}}/perk-state (NEO-48).
public sealed class PerkStateSnapshotResponse
{
public const int CurrentSchemaVersion = 1;
[JsonPropertyName("schemaVersion")]
public int SchemaVersion { get; init; } = CurrentSchemaVersion;
[JsonPropertyName("playerId")]
public required string PlayerId { get; init; }
/// Branch picks per skill. Consumers key by — array order is not part of the contract.
[JsonPropertyName("branchPicks")]
public required IReadOnlyList BranchPicks { get; init; }
[JsonPropertyName("unlockedPerkIds")]
public required IReadOnlyList UnlockedPerkIds { get; init; }
}
public sealed class PerkBranchPickTrackJson
{
[JsonPropertyName("skillId")]
public required string SkillId { get; init; }
[JsonPropertyName("picks")]
public required IReadOnlyList Picks { get; init; }
}
public sealed class PerkBranchPickRowJson
{
[JsonPropertyName("tierIndex")]
public int TierIndex { get; init; }
[JsonPropertyName("branchId")]
public required string BranchId { get; init; }
}
/// POST body for branch selection on POST …/perk-state (NEO-48).
public sealed class PerkBranchSelectRequest
{
public const int CurrentSchemaVersion = 1;
[JsonPropertyName("schemaVersion")]
public int SchemaVersion { get; init; }
[JsonPropertyName("skillId")]
public required string SkillId { get; init; }
[JsonPropertyName("tierIndex")]
public int TierIndex { get; init; }
[JsonPropertyName("branchId")]
public required string BranchId { get; init; }
}
/// POST responses for branch selection — success () or structured deny ().
public sealed class PerkBranchSelectResponse
{
public const int CurrentSchemaVersion = 1;
[JsonPropertyName("schemaVersion")]
public int SchemaVersion { get; init; } = CurrentSchemaVersion;
[JsonPropertyName("selected")]
public bool Selected { get; init; }
[JsonPropertyName("reasonCode")]
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public string? ReasonCode { get; init; }
[JsonPropertyName("perkState")]
public required PerkStateSnapshotResponse PerkState { get; init; }
[JsonPropertyName("unlockedEvents")]
public required IReadOnlyList UnlockedEvents { get; init; }
}
public sealed class PerkUnlockedEventJson
{
[JsonPropertyName("perkId")]
public required string PerkId { get; init; }
[JsonPropertyName("skillId")]
public required string SkillId { get; init; }
[JsonPropertyName("tierIndex")]
public int TierIndex { get; init; }
[JsonPropertyName("branchId")]
public string? BranchId { get; init; }
[JsonPropertyName("source")]
public required string Source { get; init; }
}