using System;
using System.Collections.Generic;
using ZB.MOM.WW.MxGateway.Contracts.Proto;
namespace ZB.MOM.WW.MxGateway.Worker.MxAccess;
///
/// Per-session interface routing the worker's alarm IPC commands —
/// SubscribeAlarmsCommand, AcknowledgeAlarmCommand,
/// QueryActiveAlarmsCommand, UnsubscribeAlarmsCommand —
/// to the underlying . Production binding
/// is ; tests substitute a fake.
///
public interface IAlarmCommandHandler : IDisposable
{
///
/// Begin an alarm subscription from the supplied command. The command's
/// and
/// select the consumer:
/// alarmmgr-only (the default), subtag-only, or an auto-failover
/// composite over both.
///
/// The full SubscribeAlarms command.
/// The session identifier.
void Subscribe(SubscribeAlarmsCommand command, string sessionId);
/// Tear down the active subscription. No-op if not subscribed.
void Unsubscribe();
/// Acknowledge a single alarm by GUID. Returns AVEVA's native status (0 = success).
/// The alarm GUID.
/// The acknowledgment comment.
/// The operator user name.
/// The operator node name.
/// The operator domain name.
/// The operator full name.
int Acknowledge(
Guid alarmGuid,
string comment,
string operatorUser,
string operatorNode,
string operatorDomain,
string operatorFullName);
///
/// Acknowledge a single alarm by (name, provider, group) — used when
/// the caller has the human-readable reference but not the GUID.
///
/// The alarm name.
/// The provider name.
/// The group name.
/// The acknowledgment comment.
/// The operator user name.
/// The operator node name.
/// The operator domain name.
/// The operator full name.
int AcknowledgeByName(
string alarmName,
string providerName,
string groupName,
string comment,
string operatorUser,
string operatorNode,
string operatorDomain,
string operatorFullName);
///
/// Snapshot the currently-active alarm set, optionally scoped to a
/// prefix matched against AlarmFullReference.
///
/// Optional prefix to filter alarms by.
IReadOnlyList QueryActive(string? alarmFilterPrefix);
///
/// Drives a single poll of the underlying alarm consumer on the
/// caller's thread. This is a no-op when there is no active
/// subscription. In production the caller is the worker's STA
/// (marshalled via StaRuntime.InvokeAsync), which satisfies
/// the ThreadingModel=Apartment requirement of
/// wwAlarmConsumerClass.
///
void PollOnce();
}