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,
/// UpdateAlarmWatchListCommand, 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);
///
/// Replace the active auto-failover subscription's subtag standby
/// targets without restarting its primary provider.
///
/// The complete replacement watch list.
void UpdateWatchList(IReadOnlyList watchList);
/// Tear down the active subscription. No-op if not subscribed.
void Unsubscribe();
/// Acknowledges an alarm by GUID as .
/// The alarm GUID.
/// The acknowledgement comment written to the alarm's ack item.
/// The operator to authenticate as (credential-sensitive).
/// The acknowledgement outcome.
AlarmAckResult Acknowledge(Guid alarmGuid, string comment, AlarmAckOperator ackOperator);
/// Acknowledges an alarm by name/provider/group as .
/// The alarm (tag) name.
/// The provider name.
/// The group name.
/// The acknowledgement comment written to the alarm's ack item.
/// The operator to authenticate as (credential-sensitive).
/// The acknowledgement outcome.
AlarmAckResult AcknowledgeByName(string alarmName, string providerName, string groupName, string comment, AlarmAckOperator ackOperator);
///
/// Snapshot the currently-active alarm set, optionally scoped to a
/// prefix matched against AlarmFullReference.
///
/// Optional prefix to filter alarms by.
///
/// Receives whether the fetch behind the snapshot hit the per-fetch cap,
/// so the set may omit active alarms. Carried out alongside the records
/// rather than read from a separate property, both so the pair comes from
/// one atomic consumer read and because it is the only carrier left once
/// (or an empty galaxy) filters the
/// records down to none. Never assigned when there is no active
/// subscription — that case throws rather than reporting an empty,
/// never-capped set, so a query issued before SubscribeAlarms is a
/// caller error and not a silent all-clear.
///
/// The currently active alarms matching the filter.
///
/// Thrown when there is no active subscription.
///
IReadOnlyList QueryActive(string? alarmFilterPrefix, out bool snapshotTruncated);
///
/// 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();
}