Files
SVSimServer/SVSim.EmulatedEntrypoint/Models/Dtos/RankBattle/DoMatchingResponseDto.cs
gamer147 7c4aa89d45 feat(rank-battle): RankBattleController shell + DTOs + routing smoke tests
Stands up the controller with all 13 rank-battle URL routes wired via
explicit absolute [HttpPost] attributes (multi-prefix family — can't ride
[Route(\"[controller]\")]). Real DoMatching / AiStart logic arrives in
later tasks; finish + telemetry + force-finish are returnable stubs as
of this task.

DTOs cover the request + response shapes per the spec. Note the
camelCase wire keys on AiBattlePlayerInfo (sleeveId, emblemId, ...) —
the AI battle subsystem uses camelCase, not the project-default
snake_case, per AIBattleStartTask.Parse's literal Keys.Contains lookups.

DoMatchingResponseDto.NodeServerUrl is non-nullable + always-emit (with
[JsonIgnore(Never)]) — matches Phase 2's TK2 fix because the client's
DoMatchingBase parser calls .ToString() without a Keys.Contains guard.

13 routing smoke tests confirm each URL resolves to the controller.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-06-02 01:19:02 -04:00

38 lines
1.2 KiB
C#

using System.Text.Json.Serialization;
using MessagePack;
namespace SVSim.EmulatedEntrypoint.Models.Dtos.RankBattle;
[MessagePackObject(keyAsPropertyName: true)]
public sealed class DoMatchingResponseDto
{
[JsonPropertyName("matching_state")]
[Key("matching_state")]
public int MatchingState { get; set; }
[JsonPropertyName("timeout_period")]
[Key("timeout_period")]
public int TimeoutPeriod { get; set; } = 60;
[JsonPropertyName("retry_period")]
[Key("retry_period")]
public int RetryPeriod { get; set; } = 3;
[JsonPropertyName("battle_id")]
[Key("battle_id")]
public string? BattleId { get; set; }
// Always emitted, even on RETRY. Client's DoMatchingBase.SettingDoMatchingData()
// calls .ToString() on this without a Keys.Contains guard, so absence throws
// KeyNotFoundException before the matching_state switch runs. Same Phase 2 fix
// pattern as TK2.
[JsonPropertyName("node_server_url")]
[JsonIgnore(Condition = JsonIgnoreCondition.Never)]
[Key("node_server_url")]
public string NodeServerUrl { get; set; } = "";
[JsonPropertyName("card_master_id")]
[Key("card_master_id")]
public int? CardMasterId { get; set; }
}