namespace ZB.MOM.WW.OtOpcUa.Core.Abstractions;
///
/// Test-connect probe for one driver type. Implementations deserialize a driver-config
/// JSON, attempt a cheap connection (TCP open, OPC UA session, gRPC ping — whatever the
/// driver's native protocol supports), and report success/failure with latency. Probes
/// MUST NOT mutate any persistent state; the AdminUI invokes them against transient
/// config from the typed form, NOT against the persisted DriverInstance row.
///
public interface IDriverProbe
{
/// DriverInstance.DriverType string this probe handles. Used for DI lookup.
string DriverType { get; }
///
/// Run the probe with the supplied config + timeout. Honour for
/// timeout cancellation. Never throw on connection failure; instead return a result
/// with Ok = false + a message.
///
Task ProbeAsync(string configJson, TimeSpan timeout, CancellationToken ct);
}
/// Outcome of a single call.
/// True iff the probe reached its target and the handshake succeeded.
/// Human-readable status; null on success.
/// Wall-clock duration of the successful probe; null on failure.
public sealed record DriverProbeResult(bool Ok, string? Message, TimeSpan? Latency);