using Nexus.Api.Models;
namespace Nexus.Api.Services;
///
/// Maintains a persistent WebSocket connection to the OpenClaw Gateway
/// for real-time event streaming and health monitoring.
///
public interface IGatewayConnector
{
///
/// Current WebSocket connection state.
///
GatewayConnectionState ConnectionState { get; }
///
/// Gateway version reported at last connection.
///
string? GatewayVersion { get; }
///
/// Required version from configuration, or null when unpinned.
///
string? RequiredVersion { get; }
///
/// Timestamp of the last successful connection attempt.
///
DateTimeOffset? LastConnectedAt { get; }
///
/// Number of consecutive failed connection attempts.
///
int ReconnectAttempts { get; }
///
/// Detailed status message (e.g. error or version info).
///
string? StatusMessage { get; }
}
///
/// Represents the current connection state of the GatewayConnector.
///
public enum GatewayConnectionState
{
/// Not yet attempted or initializing.
Initializing,
/// Connected and healthy.
Connected,
/// Disconnected, waiting for reconnect.
Disconnected,
/// Recoverable error, retrying.
Reconnecting,
/// Failed after maximum retries.
Failed
}