namespace ScadaLink.Commons.Messages.Notification;

/// <summary>
/// Site -> Central: submit a notification for central delivery.
/// Fire-and-forget with ack; the site retries until a <see cref="NotificationSubmitAck"/> is received.
/// </summary>
public record NotificationSubmit(
    string NotificationId,
    string ListName,
    string Subject,
    string Body,
    string SourceSiteId,
    string? SourceInstanceId,
    string? SourceScript,
    DateTimeOffset SiteEnqueuedAt);

/// <summary>
/// Central -> Site: ack sent after the notification row is persisted.
/// Idempotent — safe to re-send for the same <see cref="NotificationId"/>.
/// </summary>
public record NotificationSubmitAck(
    string NotificationId,
    bool Accepted,
    string? Error);

/// <summary>
/// Site -> Central: query the central delivery status for a <see cref="NotificationId"/>.
/// </summary>
public record NotificationStatusQuery(
    string CorrelationId,
    string NotificationId);

/// <summary>
/// Central -> Site: response carrying the current delivery status for a queried notification.
/// </summary>
public record NotificationStatusResponse(
    string CorrelationId,
    bool Found,
    string Status,
    int RetryCount,
    string? LastError,
    DateTimeOffset? DeliveredAt);
