Files
gamer147 110867358c feat(arena-colosseum): lobby + constructed entry (phase 1)
Closes 5 of arena-colosseum's 16 spec shapes (1/16 → 6/16). Lobby reads
(/top, /get_fee_info, /event_info) render an empty "no event scheduled"
payload by default; /entry + /register_deck activate via admin-flipped
ColosseumSeason + ColosseumRounds config sections.

* Schema: ViewerArenaColosseumRun standalone table (unique on ViewerId)
  with jsonb run-state columns mirroring ViewerArenaTwoPickRun.
* Config sections: ColosseumSeasonConfig (event-level), ColosseumRoundsConfig
  (the 3-round bracket). Empty defaults — IsColosseumPeriod=false.
* Migration AddArenaColosseumRun (DDL only; seed rows come from the section
  ShippedDefaults via EnsureSeedDataAsync).
* DTOs: ColosseumLobbyInfo (round-level, /top + /get_fee_info), ColosseumEventInfo
  (event-level, /event_info), ColosseumOwnStatus (shared status block),
  ColosseumEntryRef, ColosseumFeeList, ColosseumUserDeck, ColosseumBattleResults,
  ColosseumRoundDetail + ColosseumGroupRow. EventInfoResponse uses explicit
  [JsonPropertyName("1"|"2"|"3")] for the string-keyed rounds shape per spec.
* Controller: ArenaColosseumController replaces the 1-action stub with
  the five lifecycle endpoints. /top emits leader_skin_id even when 0
  (project_wire_null_policy override).
* Tests: 11 controller-level tests + 6 config round-trip tests covering
  empty-season payloads, run-seeded /top round-trip, crystal/rupy entry
  debits, now_round_id mismatch rejection, deck_no_list round-trip + reject.
2026-06-13 12:16:22 -04:00

62 lines
2.5 KiB
C#

using System.Text.Json.Serialization;
using MessagePack;
using SVSim.EmulatedEntrypoint.Models.Dtos.ArenaColosseum;
namespace SVSim.EmulatedEntrypoint.Models.Dtos.Responses.ArenaColosseum;
/// <summary>
/// <c>POST /arena_colosseum/top</c> — lobby state for an in-progress run. When no season is
/// active <see cref="ColosseumInfo.IsColosseumPeriod"/> is <c>false</c> and most other
/// fields are absent (the client guards on that flag before reading anything else).
/// </summary>
[MessagePackObject]
public class TopResponse
{
[JsonPropertyName("entry_info")] [Key("entry_info")]
public ColosseumEntryRef EntryInfo { get; set; } = new();
[JsonPropertyName("colosseum_info")] [Key("colosseum_info")]
public ColosseumLobbyInfo ColosseumInfo { get; set; } = new();
[JsonPropertyName("colosseum_status")] [Key("colosseum_status")]
public ColosseumOwnStatus ColosseumStatus { get; set; } = new();
[JsonPropertyName("now_round_id")] [Key("now_round_id")]
public int NowRoundId { get; set; }
[JsonPropertyName("user_deck")] [Key("user_deck")]
public List<ColosseumUserDeck> UserDeck { get; set; } = new();
[JsonPropertyName("max_battle_count")] [Key("max_battle_count")]
public int MaxBattleCount { get; set; }
[JsonPropertyName("is_finish")] [Key("is_finish")]
public bool IsFinish { get; set; }
[JsonPropertyName("final_round_eliminate_count")] [Key("final_round_eliminate_count")]
public int FinalRoundEliminateCount { get; set; }
[JsonPropertyName("end_time")] [Key("end_time")]
public string EndTime { get; set; } = "";
[JsonPropertyName("battle_results")] [Key("battle_results")]
public ColosseumBattleResults BattleResults { get; set; } = new();
[JsonPropertyName("breakthrough_number")] [Key("breakthrough_number")]
public int? BreakthroughNumber { get; set; }
[JsonPropertyName("box_grade_list")] [Key("box_grade_list")]
public List<int>? BoxGradeList { get; set; }
[JsonPropertyName("selected_chaos_id")] [Key("selected_chaos_id")]
public int? SelectedChaosId { get; set; }
/// <summary>ALWAYS emitted, even when 0. <c>WhenWritingNull</c> would strip this otherwise —
/// see <c>project_wire_null_policy</c>: client does <c>jsonData["leader_skin_id"].ToInt()</c>
/// unguarded, which throws a KeyNotFoundException if absent.</summary>
[JsonPropertyName("leader_skin_id")]
[JsonIgnore(Condition = JsonIgnoreCondition.Never)]
[Key("leader_skin_id")]
public long LeaderSkinId { get; set; }
}