using Microsoft.AspNetCore.Http;
namespace ZB.MOM.WW.ScadaBridge.InboundAPI;
///
/// Standby-node forwarding seam for POST /api/{methodName}. When a request
/// lands on a standby central node, hands it
/// here instead of returning HTTP 503, and the implementation relays it verbatim to
/// the active central node over HTTP so callers that address a central node directly
/// (or that hit the load balancer inside its health-probe window after a failover)
/// still get a served response. Method scripts and Route.To() calls still run
/// ONLY on the active node — the standby is a pure relay.
///
public interface IStandbyRequestForwarder
{
///
/// true when at least one peer endpoint is configured
/// (). When false
/// the filter falls back to the pre-forwarding behaviour: HTTP 503 STANDBY_NODE.
///
bool IsConfigured { get; }
///
/// Relays the current request to the first peer that serves it and returns a
/// result that replays the peer's status, content type and body to the caller.
/// Never throws for peer failures: when no peer served the request the result is
/// HTTP 503 ACTIVE_NODE_UNREACHABLE.
///
/// The inbound HTTP context on the standby node.
/// Cancelled when the caller aborts the request.
/// A result replaying the peer's response, or a 503 when no peer served it.
Task ForwardAsync(HttpContext context, CancellationToken cancellationToken);
}