namespace ZB.MOM.WW.OtOpcUa.Commons.Messages.Drivers;
///
/// Snapshot of a single driver instance's health, published to the
/// driver-health DistributedPubSub topic whenever a driver actor
/// transitions state or logs an error. Consumed by
/// DriverStatusSignalRBridge in the AdminUI for live status push.
///
/// Cluster this driver belongs to.
/// Globally-unique driver instance ID.
/// DriverState enum as string (Healthy, Faulted, Reconnecting, etc.).
/// Most recent successful equipment read; null if never.
/// Latest error message; null when none.
/// Number of state-transitions into Faulted in the last 5 minutes.
/// Timestamp this snapshot was published.
public sealed record DriverHealthChanged(
string ClusterId,
string DriverInstanceId,
string State,
DateTime? LastSuccessfulReadUtc,
string? LastError,
int ErrorCount5Min,
DateTime PublishedUtc)
{
///
/// DPS topic name. Both the runtime AkkaDriverHealthPublisher and the AdminUI
/// DriverStatusSignalRBridge reference this single constant so renames can't
/// silently desynchronise publisher and subscriber.
///
public const string TopicName = "driver-health";
}