namespace ScadaLink.Commons.Interfaces.Services;

/// <summary>
/// Interface for sending notifications.
/// Implemented by NotificationService, consumed by ScriptRuntimeContext.
/// </summary>
public interface INotificationDeliveryService
{
    /// <summary>
    /// Sends a notification to a named list. Transient failures go to S&amp;F.
    /// Permanent failures returned to caller.
    /// </summary>
    Task<NotificationResult> SendAsync(
        string listName,
        string subject,
        string message,
        string? originInstanceName = null,
        CancellationToken cancellationToken = default);
}

/// <summary>
/// Result of a notification send attempt.
/// </summary>
public record NotificationResult(
    bool Success,
    string? ErrorMessage,
    bool WasBuffered = false);
