namespace SVSim.BattleNode.Protocol;
///
/// Wire value of result on a WS BattleFinish frame.
///
/// Maps to the client's NetworkBattleReceiver.RESULT_CODE enum at
/// NetworkBattleReceiver.cs:963-986. The client extracts this via
/// NetworkBattleReceiver.cs:1170-1172:
///
/// case NetworkParameter.result:
/// _receiveData.result = (RESULT_CODE)ConvertToInt(data.Value);
///
/// then dispatches through NetworkBattleManagerBase.JudgeResultReceive
/// (lines 1412-1488). The wire codes are categorized by HOW the battle ended
/// (life / deckout / retire / disconnect / timeout) and are named from the
/// OPPONENT'S perspective:
///
///
/// - LifeLose = "opponent's life ran out" → PLAYER WIN UI
/// - LifeWin = "opponent's life win condition met" → PLAYER LOSE UI
///
///
/// Prior to 2026-06-02 the docstring here claimed the values were 0/1/2 mapping
/// LOSE/WIN/CONSISTENCY — that was the HTTP /finish response shape, not the
/// WS frame. The previous values are kept for backwards compat with the
/// Retire/Kill scripted flow (which has shipped emitting Win = 1, parsed
/// client-side as RESULT_CODE.NoContest and rendered as "battle ended in
/// no contest" — a working-but-not-quite-right scripted-bot terminator).
///
///
/// Always serialize as the int value, not the name; see the
/// JsonNumberEnumConverter on .
///
///
public enum BattleResult
{
/// Pre-2026-06-02 value, kept for the existing Retire/Kill Scripted flow.
/// Wire-equivalent of RESULT_CODE.NotFinish = 0. Don't use for new code.
Lose = 0,
/// Pre-2026-06-02 value, kept for the existing Retire/Kill Scripted flow.
/// Wire-equivalent of RESULT_CODE.NoContest = 1. Don't use for new code.
Win = 1,
/// Pre-2026-06-02 value, kept for the existing Retire/Kill Scripted flow.
/// Wire-equivalent of RESULT_CODE.Invalid = 2. Don't use for new code.
Consistency = 2,
/// Opponent's life ran out (PLAYER WIN). Pushed by Scripted mode on
/// the player's TurnEndFinal emit. Matches the prod TK2 capture at
/// data_dumps/captures/battle-traffic_tk2_regular.ndjson:274.
LifeLose = 102,
/// Opponent's life-win condition met (PLAYER LOSE). Not currently emitted
/// by Scripted mode — the bot can't kill the player — but listed for completeness.
LifeWin = 101,
}