feat(arena-colosseum): 2-pick + curated deck sources (phase 3)

Closes the family. arena-colosseum 10/16 → 15/16 zero stubs (the 16th —
finish_load — is dead per project_dead_battle_endpoints).

* 2-Pick draft lift onto ArenaColosseumController:
  - get_candidate_classes samples from ArenaTwoPickConfig.AllowedClassIds
    and persists the slate onto the run.
  - class_choose accepts class_id XOR chaos_id; both populate run.ClassId,
    chaos branch stores ChaosId for replay.
  - get_candidate_cards is the idempotent draft-resume snapshot.
  - card_choose appends both cards from the picked pair, advances turn 1..15.
  - Pool override: ArenaTwoPickCardPoolService gets a non-breaking
    GeneratePickSetsForTurn(..., poolCardSetIds) overload; Colosseum routes
    pass ColosseumSeasonConfig.PoolCardSetIds (falls back to challenge →
    rotation when empty).
* Curated-deck schema: ColosseumHofDeck / ColosseumWindFallDeck /
  ColosseumAvatarDeck — three identical tables (separate per per-pool
  operational lifecycle), unique on DeckNo. Migration AddColosseumCuratedDecks.
* IColosseumCuratedDeck interface + a generic ColosseumCuratedDeckImporterBase<T>
  with three concrete subclasses (HOF / WindFall / Avatar), registered in
  Bootstrap. Seed files ship empty.
* 6 curated endpoints on ArenaColosseumController: get_{hof|windfall|avatar}_deck_list
  return BARE-ARRAY data per spec; register_{hof|windfall|avatar}_deck share
  one generic RegisterCuratedAsync<T> dispatcher. Cross-pool register
  rejected via per-pool lookup. Curated register has no is_published flag
  (constructed-only) — clears the run's flag for state consistency.
* Tests: 5 draft HTTP tests + 11 curated-deck HTTP tests (4 parameterized
  3 ways across HOF/WindFall/Avatar + a cross-pool isolation test + an
  is_published clear test). Existing TwoPick service tests updated for the
  new pool overload. Full suite: 1347/1347.

Phase 3 ship gate met. Branch ready for merge.
This commit is contained in:
gamer147
2026-06-13 12:49:57 -04:00
parent cbee0f9a50
commit d126649ad4
25 changed files with 6152 additions and 6 deletions

View File

@@ -0,0 +1,32 @@
using System.Text.Json.Serialization;
using MessagePack;
namespace SVSim.EmulatedEntrypoint.Models.Dtos.ArenaColosseum;
/// <summary>
/// Wire shape for a single curated deck on <c>/get_{hof|windfall|avatar}_deck_list</c>.
/// The list response is a BARE ARRAY at the <c>data</c> level per spec — client iterates
/// directly without a wrapper object. Sleeve/skin are optional; client falls back to
/// defaults when absent.
/// </summary>
[MessagePackObject]
public sealed class ColosseumCuratedDeckEntry
{
[JsonPropertyName("deck_id")] [Key("deck_id")]
public int DeckId { get; set; }
[JsonPropertyName("class_id")] [Key("class_id")]
public int ClassId { get; set; }
[JsonPropertyName("card_list")] [Key("card_list")]
public List<long> CardList { get; set; } = new();
[JsonPropertyName("sleeve_id")] [Key("sleeve_id")]
public long? SleeveId { get; set; }
[JsonPropertyName("skin_id")] [Key("skin_id")]
public long? SkinId { get; set; }
[JsonPropertyName("deck_name")] [Key("deck_name")]
public string? DeckName { get; set; }
}

View File

@@ -0,0 +1,12 @@
using System.Text.Json.Serialization;
using MessagePack;
using SVSim.EmulatedEntrypoint.Models.Dtos.Requests;
namespace SVSim.EmulatedEntrypoint.Models.Dtos.Requests.ArenaColosseum;
[MessagePackObject]
public sealed class ArenaColosseumCardChooseRequest : BaseRequest
{
[JsonPropertyName("selected_id")] [Key("selected_id")]
public long SelectedId { get; set; }
}

View File

@@ -0,0 +1,22 @@
using System.Text.Json.Serialization;
using MessagePack;
using SVSim.EmulatedEntrypoint.Models.Dtos.Requests;
namespace SVSim.EmulatedEntrypoint.Models.Dtos.Requests.ArenaColosseum;
/// <summary>
/// <c>POST /arena_colosseum/class_choose</c>. Two mutually-exclusive request shapes per
/// class-choose.md — Normal sends <c>class_id</c>, Chaos sends <c>chaos_id</c>. Both fields
/// are bound on this DTO; the server picks the mode by which is non-zero and rejects when
/// both are present (or neither).
/// </summary>
[MessagePackObject]
public sealed class ArenaColosseumClassChooseRequest : BaseRequest
{
[JsonPropertyName("class_id")] [Key("class_id")]
public int ClassId { get; set; }
/// <summary>Chaos sub-mode replay id. 0 in Normal mode.</summary>
[JsonPropertyName("chaos_id")] [Key("chaos_id")]
public int ChaosId { get; set; }
}

View File

@@ -0,0 +1,18 @@
using System.Text.Json.Serialization;
using MessagePack;
using SVSim.EmulatedEntrypoint.Models.Dtos.Requests;
namespace SVSim.EmulatedEntrypoint.Models.Dtos.Requests.ArenaColosseum;
/// <summary>
/// Shared request shape for the three curated-deck register URLs (HOF / WindFall / Avatar).
/// Same JSON-encoded-string gotcha as <see cref="ArenaColosseumRegisterDeckRequest"/> —
/// <c>deck_no_list</c> is a wire string like <c>"[1001,1002]"</c>. No <c>is_published</c>
/// here (constructed-only flag per spec).
/// </summary>
[MessagePackObject]
public sealed class RegisterCuratedDeckRequest : BaseRequest
{
[JsonPropertyName("deck_no_list")] [Key("deck_no_list")]
public string DeckNoList { get; set; } = "[]";
}

View File

@@ -0,0 +1,27 @@
using System.Text.Json.Serialization;
using MessagePack;
using SVSim.EmulatedEntrypoint.Models.Dtos.Common.ArenaTwoPick;
namespace SVSim.EmulatedEntrypoint.Models.Dtos.Responses.ArenaColosseum;
/// <summary>
/// <c>POST /arena_colosseum/get_candidate_cards</c>. Idempotent draft-resume — server emits
/// the current snapshot for the active run plus the pending pair offer. The Common
/// <c>DeckInfoDto</c>/<c>CandidatePairDto</c>/<c>ClassInfoDto</c> shapes are shared with
/// arena-two-pick and arena-competition per spec.
/// </summary>
[MessagePackObject]
public sealed class GetCandidateCardsResponse
{
[JsonPropertyName("deck_info")] [Key("deck_info")]
public DeckInfoDto DeckInfo { get; set; } = new();
[JsonPropertyName("candidate_card_list")] [Key("candidate_card_list")]
public List<CandidatePairDto> CandidateCardList { get; set; } = new();
[JsonPropertyName("leader_skin_id")] [Key("leader_skin_id")]
public long? LeaderSkinId { get; set; }
[JsonPropertyName("class_info")] [Key("class_info")]
public ClassInfoDto ClassInfo { get; set; } = new();
}

View File

@@ -0,0 +1,41 @@
using System.Text.Json.Serialization;
using MessagePack;
namespace SVSim.EmulatedEntrypoint.Models.Dtos.Responses.ArenaColosseum;
/// <summary>
/// <c>POST /arena_colosseum/get_candidate_classes</c>. Two mutually-exclusive sub-shapes —
/// Normal 2-pick emits <c>class_id_1/2/3</c>; Chaos emits <c>chaos_id_1/2/3</c> +
/// <c>chaos_info</c>. <c>WhenWritingNull</c> strips the inactive branch so the wire matches
/// the spec exactly.
/// </summary>
[MessagePackObject]
public sealed class GetCandidateClassesResponse
{
[JsonPropertyName("class_id_1")] [Key("class_id_1")]
public int? ClassId1 { get; set; }
[JsonPropertyName("class_id_2")] [Key("class_id_2")]
public int? ClassId2 { get; set; }
[JsonPropertyName("class_id_3")] [Key("class_id_3")]
public int? ClassId3 { get; set; }
[JsonPropertyName("chaos_id_1")] [Key("chaos_id_1")]
public int? ChaosId1 { get; set; }
[JsonPropertyName("chaos_id_2")] [Key("chaos_id_2")]
public int? ChaosId2 { get; set; }
[JsonPropertyName("chaos_id_3")] [Key("chaos_id_3")]
public int? ChaosId3 { get; set; }
[JsonPropertyName("selected_chaos_id")] [Key("selected_chaos_id")]
public int? SelectedChaosId { get; set; }
[JsonPropertyName("selected_class_id")] [Key("selected_class_id")]
public int? SelectedClassId { get; set; }
[JsonPropertyName("selected_leader_skin_id")] [Key("selected_leader_skin_id")]
public long? SelectedLeaderSkinId { get; set; }
}