import '../entities/food_log_entry.dart'; import '../entities/hydration_log_entry.dart'; /// Persistence contract for the nutrition bounded context. /// /// The presentation layer depends only on this interface; the drift-backed /// implementation lives in `data/repositories/` so widgets and controllers /// remain testable with in-memory fakes. abstract class INutritionRepository { // --------------------------------------------------------------------------- // Food diary // --------------------------------------------------------------------------- /// Emits the food diary (newest first) whenever it changes. Stream> watchFoodLogs({int limit = 500}); /// One-shot snapshot of the food diary (newest first). /// /// When [from]/[to] are provided only entries with `from <= timestamp < to` /// are returned, which the controller uses to build the "today" view. Future> getFoodLogs({ int limit = 500, DateTime? from, DateTime? to, }); /// Persists [entry]; when [FoodLogEntry.id] is `null` a new row is inserted, /// otherwise the existing row is updated. Returns the stored entry with its /// database-assigned identifier. Future saveFoodLog(FoodLogEntry entry); /// Removes the food entry with [id], if present. Future deleteFoodLog(int id); // --------------------------------------------------------------------------- // Hydration // --------------------------------------------------------------------------- /// Emits the hydration log (newest first) whenever it changes. Stream> watchHydrationLogs({int limit = 500}); /// One-shot snapshot of the hydration log (newest first), optionally /// filtered by the half-open interval `[from, to)`. Future> getHydrationLogs({ int limit = 500, DateTime? from, DateTime? to, }); /// Persists [entry]; when [HydrationLogEntry.id] is `null` a new row is /// inserted, otherwise the existing row is updated. Returns the stored entry /// with its database-assigned identifier. Future saveHydrationLog(HydrationLogEntry entry); /// Removes the hydration entry with [id], if present. Future deleteHydrationLog(int id); }