using ZB.MOM.WW.ScadaBridge.Commons.Messages.Management;
using ZB.MOM.WW.ScadaBridge.Commons.Types.DataConnections;
namespace ZB.MOM.WW.ScadaBridge.CentralUI.Services;
///
/// CentralUI facade over the central-to-site verify-endpoint command. Backs the
/// "Verify endpoint" button on the OPC UA endpoint editor: it serializes the
/// in-progress endpoint config and forwards a
/// to the owning site via
/// , which
/// runs a read-only connect probe and reports back a typed
/// .
///
///
/// The service is the trust boundary for the verify capability: it enforces the
/// Design role at central before any cross-cluster traffic is generated,
/// because site-side actors do not unwrap the central trust envelope (mirrors
/// ). Transport failures (timeouts, unreachable sites)
/// are translated into a typed so the editor can
/// render an inline outcome rather than throwing.
///
public interface IEndpointVerificationService
{
///
/// Runs a read-only verification probe of against the
/// live server at . The probe connects, captures
/// the server certificate if it is untrusted, then disconnects — it never persists
/// the config and never trusts the certificate (cert trust is a later action).
///
/// The target site identifier (the machine-readable SiteIdentifier used in Akka addresses, NOT the numeric primary key).
/// Name of the data connection being verified (for logging/correlation).
/// Protocol type string (e.g. "OpcUa"); matched case-insensitively at the site.
/// The endpoint configuration to verify; serialized to JSON before being sent to the site.
/// Cancellation token.
/// A task that resolves to a — success, or a classified failure (with a captured certificate when the failure is ).
Task VerifyAsync(
string siteIdentifier,
string connectionName,
string protocol,
OpcUaEndpointConfig config,
CancellationToken cancellationToken = default);
}