import 'package:isar/isar.dart'; import 'package:uuid/uuid.dart'; part 'workout.g.dart'; @collection class Workout { Id id = Isar.autoIncrement; @Index(unique: true) late String uuid; late DateTime date; @enumerated late WorkoutType type; String? note; /// 1-10 scale, optional int? mood; /// Duration in minutes int? duration; DateTime createdAt = DateTime.now(); /// Backlink to exercises @Backlink(to: 'workout') final workoutExercises = IsarLinks(); Workout() { uuid = const Uuid().v4(); } } enum WorkoutType { strength, cardio, mixed, other } extension WorkoutTypeExtension on WorkoutType { String get displayName { switch (this) { case WorkoutType.strength: return 'Siłowy'; case WorkoutType.cardio: return 'Cardio'; case WorkoutType.mixed: return 'Mieszany'; case WorkoutType.other: return 'Inny'; } } String get icon { switch (this) { case WorkoutType.strength: return '💪'; case WorkoutType.cardio: return '🏃'; case WorkoutType.mixed: return '🔄'; case WorkoutType.other: return '📝'; } } }