using Akka.Actor;
namespace ZB.MOM.WW.ScadaBridge.Communication.Actors;
///
/// The central→site command-send seam, injected into
/// below the handler. The sole implementation is
/// , over the site
/// SiteCommandService gRPC plane. The seam predates that: it was introduced so the Akka
/// ClusterClient path and the gRPC plane could run side by side during the migration, and
/// is kept because it is the natural substitution point for tests.
/// The producers above the seam (CommunicationService's 27 commands, SiteCallAuditActor's
/// 2 parked relays, and DebugStreamBridgeActor's subscribe/unsubscribe) are unchanged — they
/// still Ask/Tell a to the actor, which delegates here.
///
///
/// Both members run on the actor thread (from the and
/// SiteAddressCacheLoaded handlers), so implementations need no internal synchronisation for
/// their own per-site bookkeeping beyond what a background failback loop requires.
///
public interface ISiteCommandTransport
{
///
/// Routes 's message to its site. Any reply the site produces is
/// delivered to — for an Ask that is the temporary ask actor
/// (completing the caller's task); for a Tell-with-sender (the debug bridge) that is the
/// originating actor. A message with no route (an unknown/unconfigured site) fails fast: a
/// is delivered to immediately instead of
/// letting the caller's Ask burn its full timeout — central still never buffers for an
/// unreachable site.
///
/// The site-addressed command envelope.
/// Where a reply (or a ) is delivered.
void Send(SiteEnvelope envelope, IActorRef replyTo);
///
/// Reconciles per-site transport resources (gRPC channel pairs)
/// against the freshly loaded site set. Called once per DB refresh tick with the same cache
/// message the actor already receives — the ONE DB-poll loop feeds both transports.
///
/// The loaded site address cache (Akka contacts + gRPC endpoints + known ids).
void ReconcileSites(SiteAddressCacheLoaded cache);
}