Files
SVSimServer/SVSim.Database/Models/Config/ColosseumRoundsConfig.cs
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

48 lines
1.7 KiB
C#

namespace SVSim.Database.Models.Config;
/// <summary>
/// The 3-round bracket schedule for an active Colosseum season. Empty <see cref="Rounds"/>
/// is the default shipped state — lobby <c>/event_info</c> renders a benign payload with
/// no rounds active. Collection default is in <see cref="ShippedDefaults"/> per
/// feedback_config_defaults (property-initializer collection defaults silently empty out
/// under the tier merge).
/// </summary>
[ConfigSection("ColosseumRounds")]
public class ColosseumRoundsConfig
{
public List<RoundEntry> Rounds { get; set; } = new();
public static ColosseumRoundsConfig ShippedDefaults() => new()
{
Rounds = new(),
};
public class RoundEntry
{
/// <summary>1, 2, or 3 in the canonical 3-round schedule.</summary>
public int RoundId { get; set; }
public DateTime StartTime { get; set; }
public DateTime EndTime { get; set; }
/// <summary>Bracket groups within the round (e.g. distinct breakthrough thresholds
/// for late-joiners). The first entry is the canonical lookup used by
/// <c>ColosseumProgressionService</c> for the v1 single-bracket case.</summary>
public List<GroupEntry> Groups { get; set; } = new();
}
public class GroupEntry
{
public string Group { get; set; } = "";
/// <summary>Max battles a viewer can play in this round before bracket termination.</summary>
public int MaxBattleCount { get; set; }
/// <summary>Wins required to promote out of this round.</summary>
public int BreakthroughNumber { get; set; }
/// <summary>Total bracket entries allotted to this group.</summary>
public int EntryNumber { get; set; }
}
}