import 'meal_type.dart'; /// Immutable record of a single meal or snack intake. /// /// Pure Dart (no framework imports) so the entity can be shared by the /// nutrition use cases, the drift-backed repository, and the Riverpod /// presentation layer without leaking infrastructure concerns into the /// domain. class FoodLogEntry { const FoodLogEntry({ this.id, required this.timestamp, required this.mealType, required this.description, required this.proteinGrams, required this.calories, this.carbsGrams, this.fatGrams, }); /// Database primary key; `null` until the entry has been persisted. final int? id; /// When the food was consumed. final DateTime timestamp; /// Meal slot the entry belongs to (drives diary grouping). final MealType mealType; /// Free-text description of the meal (e.g. "Greek yogurt with berries"). final String description; /// Protein content in grams; the primary lean-mass tracking metric. final double proteinGrams; /// Energy content in kilocalories. final int calories; /// Carbohydrate content in grams; optional per the Phase 3 contract. final double? carbsGrams; /// Fat content in grams; optional per the Phase 3 contract. final double? fatGrams; /// Copy helper preserving the database identifier. FoodLogEntry copyWith({ int? id, DateTime? timestamp, MealType? mealType, String? description, double? proteinGrams, int? calories, double? carbsGrams, double? fatGrams, }) => FoodLogEntry( id: id ?? this.id, timestamp: timestamp ?? this.timestamp, mealType: mealType ?? this.mealType, description: description ?? this.description, proteinGrams: proteinGrams ?? this.proteinGrams, calories: calories ?? this.calories, carbsGrams: carbsGrams ?? this.carbsGrams, fatGrams: fatGrams ?? this.fatGrams, ); }