using ZB.MOM.WW.OtOpcUa.Commons.Types;

namespace ZB.MOM.WW.OtOpcUa.Commons.Messages.Admin;

/// <summary>
///     AdminUI → AdminOperationsActor: acknowledge one alarm on behalf of an operator. The admin
///     singleton maps this to a <c>Commons.OpcUa.AlarmCommand</c> with <c>Operation = "Acknowledge"</c>
///     and republishes it onto the cluster <c>alarm-commands</c> topic, where the owning
///     <c>ScriptedAlarmHostActor</c> filters by ownership and drives the engine. Routing this through
///     the admin-pinned singleton lets the AdminUI act without knowing which node owns the alarm —
///     the broadcast + ownership filter handle cross-node delivery.
/// </summary>
/// <param name="AlarmId">The alarm's ScriptedAlarmId (the <c>AlarmTransitionEvent.AlarmId</c> shown on the row).</param>
/// <param name="User">The authenticated operator who triggered the acknowledgement.</param>
/// <param name="Comment">Optional free-text comment supplied with the acknowledgement; null when none.</param>
/// <param name="CorrelationId">Round-trip correlation token.</param>
public sealed record AcknowledgeAlarmCommand(
    string AlarmId,
    string User,
    string? Comment,
    CorrelationId CorrelationId);

/// <summary>Reply for <see cref="AcknowledgeAlarmCommand"/>.</summary>
/// <param name="Ok">True iff the command was published without error.</param>
/// <param name="Message">Failure reason; null on success.</param>
/// <param name="CorrelationId">Echoes the request's correlation token.</param>
public sealed record AcknowledgeAlarmResult(
    bool Ok,
    string? Message,
    CorrelationId CorrelationId);
