second commit

This commit is contained in:
2026-07-29 11:41:53 +05:30
parent fcccf22bac
commit d72522e737
211 changed files with 19260 additions and 0 deletions

View File

@@ -0,0 +1,38 @@
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<SyncEvent> 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<SyncEvent> pushShiftReport(ShiftReport report);
/// Retries a previously failed or pending push.
Future<SyncEvent> retry(String eventId);
List<SyncEvent> get events;
bool get hasUnsyncedEvents;
}