namespace ZB.MOM.WW.OtOpcUa.Driver.TwinCAT;
///
/// Per-device runtime diagnostics surfaced by the TwinCAT probe loop (PR 3.2 / issue #314).
/// Built by reading four well-known system symbols once per probe interval and stashed on
/// alongside the existing reachability
/// state. The driver also folds the latest snapshot into
/// so the cross-driver
/// driver-diagnostics RPC (introduced for Modbus task #154) can render TwinCAT
/// cycle-time / jitter / online-change counters next to its peers without a per-driver
/// special-case.
///
///
/// Value of TwinCAT_SystemInfoVarList._AppInfo.AppName. Identifies the running PLC
/// application (e.g. "Plc1") so an operator can tell which project is loaded against
/// the AMS target.
///
///
/// Value of TwinCAT_SystemInfoVarList._AppInfo.OnlineChangeCnt. Increments on every
/// accepted online-change. Diffing the value across probe ticks lets operators (and the
/// driver itself) react to runtime symbol-table churn — see the
/// TwinCAT.OnlineChangeCntDelta diagnostic key.
///
///
/// Value of TwinCAT_SystemInfoVarList._TaskInfo[1].CycleTime after the
/// 100 ns → ms conversion. Configured task period; constant under normal operation.
///
///
/// Value of TwinCAT_SystemInfoVarList._TaskInfo[1].LastExecTime after the
/// 100 ns → ms conversion. Wall-clock time the last task tick spent running. Compared to
/// to surface jitter / overrun.
///
///
/// LastExecTimeMs - CycleTimeMs. Positive values indicate the task overran its
/// configured cycle (potential cycle exceedance); negative / zero values are healthy.
///
/// UTC instant the snapshot was captured.
///
/// Each field is best-effort — the probe wraps individual symbol reads in try/catch so a
/// runtime that doesn't expose _TaskInfo[1] (older TwinCAT 2 builds) still produces a
/// partial snapshot with a non-null + .
/// Missing reads fall back to the previous snapshot's value (or the type default for the
/// first probe tick).
///
public sealed record TwinCATDeviceDiagnostics(
string? AppName,
uint OnlineChangeCnt,
double CycleTimeMs,
double LastExecTimeMs,
double JitterMs,
DateTimeOffset UpdatedAt);