using SVSim.Database.Enums;
using SVSim.Database.Models;
using SVSim.Database.Models.Config;
namespace SVSim.EmulatedEntrypoint.Services.ArenaColosseum;
///
/// Pure-logic decisions for the Colosseum bracket lifecycle. Reads a
/// + snapshot and
/// returns advancement / promotion / reward decisions. Side-effectful (debits, grants,
/// run-row writes) live on the controllers — this service just computes.
///
public interface IColosseumProgressionService
{
/// True when the node signal matching_state == 3008 indicates the run
/// has been promoted to the ranked bracket and we haven't already flipped the flag.
/// Subsequent battle URLs route to colosseum_rank_battle/*.
bool ShouldPromoteToRankMatching(ViewerArenaColosseumRun run, int matchingState);
/// Triggered post-match-finish when wins/losses cross thresholds. Returns the
/// next round id (or current if no change), whether the bracket has ended, and the
/// champion flag for the final-round-cleared case.
AdvancementDecision DecideAdvancement(ViewerArenaColosseumRun run, ColosseumRoundsConfig rounds);
/// Bundle to grant on /retire. Reads
/// for the run's
/// . Empty when no matching round.
IReadOnlyList BuildRetireRewards(
ViewerArenaColosseumRun run, ColosseumRoundsConfig rounds);
/// Bundle to grant on /finish. Combines the current round's
/// with
/// when the run is a champion.
IReadOnlyList BuildFinishRewards(
ViewerArenaColosseumRun run, ColosseumRoundsConfig rounds);
}
/// Output of .
public sealed record AdvancementDecision(int NextRoundId, bool IsBracketEnd, bool IsChampion);