using ZB.MOM.WW.OtOpcUa.Commons.Types;

namespace ZB.MOM.WW.OtOpcUa.Commons.Interfaces;

public sealed record DriverInstanceDiagnostics(
    Guid DriverInstanceId,
    string Name,
    string State,
    int ConnectedDevices,
    int FaultedDevices,
    DateTime LastChangeUtc);

/// <summary>
/// Per-node diagnostics returned by <c>IFleetDiagnosticsClient</c>. Populated by the node's
/// local <c>DriverHostActor</c> via a request/response over Akka.
/// </summary>
/// <param name="RunningFromCache">
///     True when the node booted its configuration from the node-local artifact cache because the
///     central ConfigDb was unreachable. Such a node looks entirely healthy — full address space,
///     live values — but its configuration is frozen and no deployment can reach it, so the state
///     needs to be explicitly visible rather than inferred. Defaults to false, which is also what
///     every node that booted normally reports.
/// </param>
public sealed record NodeDiagnosticsSnapshot(
    NodeId NodeId,
    RevisionHash? CurrentRevision,
    IReadOnlyList<DriverInstanceDiagnostics> Drivers,
    DateTime AsOfUtc,
    bool RunningFromCache = false);
