namespace ZB.MOM.WW.OtOpcUa.Core.Abstractions;
///
/// Optional companion to : the driver says when the standing state of a set of its
/// conditions has been established — the initial replay, refresh, poll or walk that covers them has
/// completed and every alarm event it produced has already been raised (plan
/// 2026-11-23-grpc-data-connections-history-alarms §5.1, F1/F2/G1/G5).
///
///
///
/// An ordered callback, never a (F2). Raise
/// synchronously, on the same thread and callback path as
/// , after the last alarm event the completed read covers. The
/// host marshals both onto the same actor mailbox, so the "known" mark it derives is applied after every
/// projection the driver emitted before raising it. A task continuation could overtake queued transitions.
///
///
/// Carry what it covers (G1). lists the driver
/// ConditionIds (= the condition's RawPath, the routing key of the alarm event) whose state the
/// completed read established — never "the whole driver". An unreachable device's conditions are simply
/// left out and stay unknown.
///
///
/// Raise on every completed read or cycle, not only the first. Repeats are no-ops downstream; they are
/// what makes conditions known again after a reconnect or a deploy that adds conditions.
///
///
/// Suppression gate (G5). Obey exactly the gate obeys: raise
/// only while an alarm subscription is live. A refresh / poll / sentinel that completes while events are
/// suppressed raises nothing; the first signal after (re)subscribe follows the post-subscribe replay.
///
///
/// A source that cannot signal at all (an OPC UA upstream without ConditionRefresh) raises the event
/// once with set: the host then applies its
/// per-driver-type backstop timer to those conditions instead. No other shipped source should use it.
///
///
public interface IAlarmInitialStateSignal
{
/// The standing state of has been delivered.
event EventHandler? InitialAlarmStateDelivered;
}
/// Payload of .
public sealed class AlarmInitialStateEventArgs : EventArgs
{
/// Creates the payload.
/// The driver condition ids (RawPaths) whose state the completed read established.
///
/// when the source can never signal for these conditions (no refresh upstream);
/// the host's backstop timer applies instead of an immediate mark.
///
public AlarmInitialStateEventArgs(IReadOnlyList conditionIds, bool unsignalable = false)
{
ArgumentNullException.ThrowIfNull(conditionIds);
ConditionIds = conditionIds;
Unsignalable = unsignalable;
}
/// The driver condition ids (= RawPaths) the completed read covers. Never "everything".
public IReadOnlyList ConditionIds { get; }
///
/// The source reports InitialStateUnsignalable for these conditions: no real signal will ever come,
/// so the per-driver-type backstop timer (OpcUaClient only) decides when they become known.
///
public bool Unsignalable { get; }
}