glp-companion/lib/features/nutrition/domain/entities/hydration_log_entry.dart

30 lines
933 B
Dart

/// Immutable record of a single fluid-intake log.
///
/// 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 HydrationLogEntry {
const HydrationLogEntry({
this.id,
required this.timestamp,
required this.volumeOz,
});
/// Database primary key; `null` until the entry has been persisted.
final int? id;
/// When the fluid was consumed.
final DateTime timestamp;
/// Consumed volume in fluid ounces (US fl oz).
final double volumeOz;
/// Copy helper preserving the database identifier.
HydrationLogEntry copyWith({int? id, DateTime? timestamp, double? volumeOz}) =>
HydrationLogEntry(
id: id ?? this.id,
timestamp: timestamp ?? this.timestamp,
volumeOz: volumeOz ?? this.volumeOz,
);
}