namespace NexusReader.Application.Abstractions.Messaging;
///
/// Abstraction for broadcasting real-time sync events to connected clients.
/// Defined in Application to prevent a direct dependency on SignalR in Application layer handlers.
///
public interface ISyncBroadcaster
{
///
/// Broadcasts a reading progress update to all devices belonging to the specified user,
/// optionally excluding the originating connection.
///
/// The user whose other devices should be notified.
/// The block/page ID the user has reached.
/// The server-side UTC timestamp of the update.
/// SignalR connection ID to exclude (the sender's device).
/// Cancellation token.
Task BroadcastProgressAsync(
string userId,
string pageId,
DateTime timestamp,
string? excludedConnectionId,
CancellationToken cancellationToken = default);
///
/// Broadcasts real-time ingestion status updates to a specific user.
/// This is used by background workers to provide feedback during AI-intensive processing.
///
/// The ID of the user who owns the ingestion request.
/// A human-readable status message (e.g., "Parsing chapters...").
/// Progress percentage (0.0 to 1.0).
/// Cancellation token.
Task BroadcastIngestionProgressAsync(
string userId,
string message,
double progress,
CancellationToken cancellationToken = default);
}