namespace Infrastructure.Health; /// /// Event arguments for client health changes /// public class ClientHealthChangedEventArgs : EventArgs { /// /// Gets the client ID /// public Guid ClientId { get; } /// /// Gets the health status /// public HealthStatus Status { get; } /// /// Gets a value indicating whether this is a transition to a healthy state /// public bool IsRecovered { get; } /// /// Gets a value indicating whether this is a transition to an unhealthy state /// public bool IsDegraded { get; } /// /// Initializes a new instance of the class /// /// The client ID /// The current health status /// The previous health status, if any public ClientHealthChangedEventArgs(Guid clientId, HealthStatus status, HealthStatus? previousStatus) { ClientId = clientId; Status = status; // Determine if this is a state transition if (previousStatus != null) { IsRecovered = !previousStatus.IsHealthy && status.IsHealthy; IsDegraded = previousStatus.IsHealthy && !status.IsHealthy; } else { IsRecovered = false; IsDegraded = !status.IsHealthy; } } }