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.
///
/// When the driver last raised IRediscoverable.OnRediscoveryNeeded — i.e. it observed that the
/// remote's tag set may have changed (a Galaxy redeploy, a TwinCAT symbol-version bump, an MTConnect
/// agent restart, a Sparkplug rebirth). Null when the driver has never raised it, or does not
/// implement IRediscoverable.
/// Advisory only. The served address space is NOT rebuilt in response — raw tags are
/// authored explicitly through the /raw browse-commit flow. This is a prompt for an operator
/// to re-browse the device and commit whatever changed.
///
///
/// The driver-supplied reason string from the same event (e.g. "deploy-time-changed"), shown
/// to the operator alongside the prompt. Null when is null.
///
public sealed record DriverHealthChanged(
string ClusterId,
string DriverInstanceId,
string State,
DateTime? LastSuccessfulReadUtc,
string? LastError,
int ErrorCount5Min,
DateTime PublishedUtc,
DateTime? RediscoveryNeededUtc = null,
string? RediscoveryReason = null)
{
///
/// 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";
}