import '../entities/shift_report.dart'; import '../entities/sync_event.dart'; /// The terminal's two network touchpoints, plus the durable event log. abstract class SyncRepository { /// True once products have been pulled onto this terminal. bool get hasCatalogue; DateTime? get lastImportAt; String? get catalogueRevision; /// Pulls the catalogue and writes it locally. /// /// Records a [SyncEventType.catalogueImport] event whether or not it /// succeeds, so the log reflects every attempt. Future importCatalogue({ void Function(double progress, String stage)? onProgress, }); /// Builds the day's report from locally stored sales. ShiftReport buildShiftReport({ required DateTime businessDate, required String terminalId, required String cashierName, }); /// Queues the report and attempts to push it. /// /// On failure the event is kept in [SyncStatus.failed] so nothing is lost. Future pushShiftReport(ShiftReport report); /// Retries a previously failed or pending push. Future retry(String eventId); List get events; bool get hasUnsyncedEvents; }