using Akka.Actor;
namespace ZB.MOM.WW.ScadaBridge.NotificationOutbox.Messages;
///
/// Actor-internal message types for the . These are
/// never sent across the network — they bridge the actor's async repository/delivery work
/// back onto the actor's own mailbox so handlers run single-threaded on the actor.
///
internal static class InternalMessages
{
///
/// Result of an asynchronous ingest persistence attempt, piped back to the actor.
/// Carries the original so the actor can ack the site that
/// submitted the notification once the insert completes.
///
/// Id of the notification that was submitted.
/// Original submitter to receive the ack.
///
/// True if persistence completed without error — covers both a fresh insert and an
/// already-existing row (idempotent re-submission). False only when the repository threw.
///
/// Failure detail when is false; otherwise null.
internal sealed record IngestPersisted(
string NotificationId,
IActorRef Sender,
bool Succeeded,
string? Error);
///
/// Periodic tick that triggers a dispatch sweep. Started as a periodic timer in
/// PreStart at the configured DispatchInterval. A singleton instance is
/// reused so the timer carries no per-tick state.
///
internal sealed class DispatchTick
{
/// The shared singleton tick instance scheduled by the dispatch timer.
internal static readonly DispatchTick Instance = new();
private DispatchTick() { }
}
///
/// Completion signal for an asynchronous dispatch sweep, piped back to the actor so the
/// in-flight guard is cleared on the actor thread. Sent on both success and failure of
/// the sweep — the actor only needs to know the sweep has finished.
///
internal sealed class DispatchComplete
{
/// The shared singleton completion instance.
internal static readonly DispatchComplete Instance = new();
private DispatchComplete() { }
}
///
/// Periodic tick that triggers a purge sweep of terminal notification rows. Started as a
/// periodic timer in PreStart at the configured PurgeInterval. A singleton
/// instance is reused so the timer carries no per-tick state.
///
internal sealed class PurgeTick
{
/// The shared singleton tick instance scheduled by the purge timer.
internal static readonly PurgeTick Instance = new();
private PurgeTick() { }
}
///
/// Completion signal for an asynchronous purge sweep, piped back to the actor so the
/// sweep's outcome (logged in the pipe projection) is observed on the actor thread.
/// Sent on both success and failure of the sweep.
///
internal sealed class PurgeComplete
{
/// The shared singleton completion instance.
internal static readonly PurgeComplete Instance = new();
private PurgeComplete() { }
}
}