namespace ZB.MOM.WW.OtOpcUa.Core.Abstractions;
///
/// Health snapshot a driver returns to the Core. Drives the status dashboard,
/// ServiceLevel computation, and Bad-quality fan-out decisions.
///
/// Current driver-instance state.
/// Timestamp of the most recent successful equipment read; null if never.
///
/// Most recent error message; null when no error has been recorded. The type makes no
/// guarantee about correlation with — a driver in
/// may legitimately retain the last error from a recovered
/// failure (useful for diagnostics), and /
/// / states may all
/// carry a non-null message. Callers must not key behaviour on the LastError-null ↔ Healthy
/// pairing (Core.Abstractions-008).
///
public sealed record DriverHealth(
DriverState State,
DateTime? LastSuccessfulRead,
string? LastError);
/// Driver-instance lifecycle state.
public enum DriverState
{
/// Driver has not been initialized yet.
Unknown,
/// Driver is in the middle of or .
Initializing,
/// Driver is connected and serving data.
Healthy,
/// Driver is connected but reporting degraded data (e.g. some equipment unreachable, some tags Bad).
Degraded,
/// Driver lost connection to its data source; reconnecting in the background.
Reconnecting,
///
/// Driver hit an unrecoverable error and stopped trying.
/// Operator must reinitialize via Admin UI; nodes report Bad quality.
///
Faulted,
}