namespace ZB.MOM.WW.OtOpcUa.Driver.Galaxy.Runtime;
///
/// Test seam for the gateway-side Acknowledge call. Production wraps the
/// MxGatewayClient.AcknowledgeAlarmAsync RPC; tests substitute a fake
/// so can be exercised without a
/// running gateway.
///
internal interface IGalaxyAlarmAcknowledger
{
///
/// Forward a single alarm acknowledgement to the gateway. The gateway (488649c+)
/// authenticates and writes
/// to <alarm>.AckMsg as that user, so the Historian records it as the operator.
///
///
/// Fully-qualified alarm reference (e.g. "Tank01.Level.HiHi").
///
/// Ack comment written to AckMsg.
///
/// The Galaxy account to acknowledge as, resolved by .
/// Carries a password — implementations must keep it out of logs and exception text.
///
/// Cancels the gateway RPC.
///
/// Whether the gateway reported the ack APPLIED or only SENT without confirmation (lmxopcua#869). A refusal
/// or failure throws instead.
///
Task AcknowledgeAsync(
string alarmFullReference,
string comment,
GalaxyAckCredential credential,
CancellationToken cancellationToken);
}
///
/// What the gateway said about an acknowledge it accepted (lmxopcua#869). mxaccessgw answers OK both when the
/// AckMsg write's OnWriteComplete reported success () and when the write was
/// sent but no completion arrived inside the worker's window () — its contract tells
/// clients to watch the alarm stream for the real acknowledged transition in that case.
///
/// True when the gateway confirmed the ack write was applied.
/// The gateway's diagnostic message (password-scrubbed); empty when it sent none.
internal sealed record GalaxyAckOutcome(bool IsApplied, string Diagnostic)
{
/// The gateway confirmed the ack write.
public static GalaxyAckOutcome Applied { get; } = new(true, string.Empty);
/// The gateway sent the ack write but could not confirm it.
/// The gateway's diagnostic message.
/// The outcome.
public static GalaxyAckOutcome Unconfirmed(string diagnostic) => new(false, diagnostic ?? string.Empty);
}