import '../entities/customer.dart'; import '../entities/transaction.dart'; abstract class TransactionRepository { /// Persists a completed sale as one atomic unit. /// /// The bill, the stock it consumed and the shopper's loyalty movement either /// all land or none do, so a failure part-way through can never leave a /// persisted bill that the cashier believes failed. Future commitSale({ required SaleTransaction transaction, required Map stockMovements, Customer? updatedCustomer, }); /// Reverses a sale still inside its cancellation window: deletes the order, /// restores the stock it consumed, and puts an attached shopper's loyalty /// balance back to what it was immediately before the sale. /// /// Only valid before the bill has been offered to the back office — this /// does not send a cancellation anywhere, it erases the sale as if it had /// never happened locally. Future voidSale({ required SaleTransaction transaction, required Map stockMovements, }); Future> history({int limit = 50}); Future findByInvoice(String invoiceNumber); /// Next invoice sequence for the current month. Future nextInvoiceSequence(); Future park(ParkedBill bill); Future> parkedBills(); Future removeParked(String id); Future salesTotalForDay(DateTime day); }