using ScadaLink.Commons.Types;
namespace ScadaLink.Commons.Messages.RemoteQuery;
///
/// Central → site relay command: retry a parked cached operation
/// (ExternalSystem.CachedCall / Database.CachedWrite) on the
/// owning site's Store-and-Forward buffer. Sent over the command/control
/// channel by SiteCallAuditActor when an operator clicks Retry on a
/// Parked Site Call row in the Central UI.
///
///
///
/// The site is the source of truth for cached-call status — central never
/// mutates the central SiteCalls mirror row directly. This command asks
/// the site to reset its own parked row back to Pending so the S&F
/// retry sweep attempts delivery again; the corrected state then flows back to
/// central via the normal cached-call telemetry path.
///
///
/// The cached call's S&F buffer message id is the
/// itself (the tracked id is supplied as the
/// buffered row's id at enqueue time), so the site can resolve the parked row
/// directly from . A retry on a row that is not
/// actually Parked is a safe no-op at the site — the ack reports
/// Applied=false rather than corrupting a non-parked row.
///
///
/// This is a plain record carrying only ids, so it lives in Commons (no
/// IActorRef field). It mirrors
/// but keys on rather than the opaque S&F
/// message-id string.
///
///
public sealed record RetryParkedOperation(
string CorrelationId,
TrackedOperationId TrackedOperationId);
///
/// Central → site relay command: discard a parked cached operation on the
/// owning site's Store-and-Forward buffer. Sent over the command/control
/// channel by SiteCallAuditActor when an operator clicks Discard on a
/// Parked Site Call row in the Central UI. See
/// for the source-of-truth and message-id
/// rationale; Discard marks the operation terminally Discarded at the
/// site by removing the parked S&F buffer row.
///
public sealed record DiscardParkedOperation(
string CorrelationId,
TrackedOperationId TrackedOperationId);
///
/// Site → central ack for a /
/// relay command. The site replies this
/// after applying (or safely no-op-ing) the action against its own
/// Store-and-Forward buffer.
///
/// Correlation id of the originating relay command.
///
/// true when the parked operation was found and the action was applied;
/// false when no parked row matched the
/// (already delivered, discarded, never cached, or not in a Parked
/// state). A false ack is a definitive "nothing to do" answer from the
/// site — it is NOT a transport failure, so the relay must distinguish it from
/// a site-unreachable timeout.
///
///
/// Populated only when the site could not apply the action (e.g. the parked
/// message handler is not available, or the S&F store faulted); null
/// on a clean Applied=true/Applied=false outcome.
///
public sealed record ParkedOperationActionAck(
string CorrelationId,
bool Applied,
string? ErrorMessage = null);