using FieldLogger.Models;
namespace FieldLogger.Services.Sync;
///
/// Durable app MQTT synchronization. Captures are persisted locally before this service queues
/// them, and queue rows are released only by an application-level ACCEPTED/DUPLICATE ack.
///
public interface IMqttSyncService
{
bool IsConnected { get; }
string Status { get; }
event EventHandler? StatusChanged;
event EventHandler? PointRejected;
Task StartAsync(CancellationToken cancellationToken = default);
Task StopAsync();
Task ConnectAsync(CancellationToken cancellationToken = default);
Task DisconnectAsync();
Task PublishPointAsync(LoggedPoint point, CancellationToken cancellationToken = default);
}
public sealed class PointSyncFailureEventArgs : EventArgs
{
public LoggedPoint Point { get; }
public string ReasonCode { get; }
public PointSyncFailureEventArgs(LoggedPoint point, string reasonCode)
{
Point = point;
ReasonCode = reasonCode;
}
}