Single RegisterBattle(p1, p2?, type) with contract validation throws on invalid combinations (Pvp requires both; Bot requires p2==null; Scripted accepts either). PendingBattle carries Type + P1 + nullable P2. Handler + controller adapt; v1.2 behaviour preserved because Scripted is the only type used today (Phase 2 adds Pvp, Phase 3 adds Bot).
26 lines
996 B
C#
26 lines
996 B
C#
using SVSim.BattleNode.Sessions;
|
|
|
|
namespace SVSim.BattleNode.Bridge;
|
|
|
|
public interface IMatchingBridge
|
|
{
|
|
/// <summary>
|
|
/// Mint a battle id, register a pending session, return the URL the client should
|
|
/// open a socket to.
|
|
/// </summary>
|
|
/// <remarks>
|
|
/// Contract rules (enforced; throws <see cref="ArgumentException"/>):
|
|
/// <list type="bullet">
|
|
/// <item><c>Pvp</c>: <paramref name="p2"/> required. Both viewers expected to
|
|
/// connect WS within 60s.</item>
|
|
/// <item><c>Bot</c>: <paramref name="p2"/> must be null. One viewer expected;
|
|
/// opponent runs in client.</item>
|
|
/// <item><c>Scripted</c>: <paramref name="p2"/> currently null; future
|
|
/// server-driven bot config rides on <paramref name="p2"/>.</item>
|
|
/// </list>
|
|
/// </remarks>
|
|
PendingMatch RegisterBattle(BattlePlayer p1, BattlePlayer? p2, BattleType type);
|
|
}
|
|
|
|
public sealed record PendingMatch(string BattleId, string NodeServerUrl);
|