namespace ZB.MOM.WW.OtOpcUa.Core.Abstractions;
///
/// Optional driver capability for per-host connectivity reporting. Currently used by
/// the Galaxy driver (Platform / AppEngine ScanState) but generalized so future drivers
/// with multi-host topology (e.g. an OPC UA Client gateway proxying multiple upstream
/// servers) can opt in.
///
///
/// Per docs/v2/plan.md §5a — the Galaxy driver's GalaxyRuntimeProbeManager
/// becomes IHostConnectivityProbe after the v2 refactor.
///
public interface IHostConnectivityProbe
{
///
/// Snapshot of host-level connectivity. The Core uses this to drive Bad-quality
/// fan-out scoped to the affected host's subtree (not the whole driver namespace).
///
IReadOnlyList GetHostStatuses();
/// Fired when a host transitions Running ↔ Stopped (or similar lifecycle change).
event EventHandler? OnHostStatusChanged;
}
/// Per-host connectivity snapshot.
/// Driver-side host identifier (e.g. for Galaxy: Platform or AppEngine name).
/// Current state.
/// Timestamp of the last state transition.
public sealed record HostConnectivityStatus(
string HostName,
HostState State,
DateTime LastChangedUtc);
/// Event payload for .
public sealed record HostStatusChangedEventArgs(
string HostName,
HostState OldState,
HostState NewState);
/// Host lifecycle state. Generalization of Galaxy's Platform/Engine ScanState.
///
///
/// (PR ablegacy-12 / #255) is a soft-stopped state used by drivers
/// that auto-throttle a host after N consecutive comm failures. Reads are short-circuited
/// with BadCommunicationError for a configurable cool-down window so one slow PLC
/// doesn't starve faster peers sharing the same driver. Demoted is *not* the same as
/// (which means "probe says it's down") nor
/// (which means "the driver itself is broken"); it's a deliberate driver-side back-off.
/// Consumers that don't recognize Demoted can safely treat it as Stopped
/// (see HostStatusPublisher.MapState).
///
///
public enum HostState { Unknown, Running, Stopped, Faulted, Demoted }