import 'package:json_annotation/json_annotation.dart'; import 'recipe.dart'; part 'saved_recipe.g.dart'; @JsonSerializable(explicitToJson: true) class SavedRecipe { final String id; final String title; final String? description; final String? cuisine; final String? difficulty; @JsonKey(name: 'prep_time_min') final int? prepTimeMin; @JsonKey(name: 'cook_time_min') final int? cookTimeMin; final int? servings; @JsonKey(name: 'image_url') final String? imageUrl; @JsonKey(defaultValue: []) final List ingredients; @JsonKey(defaultValue: []) final List steps; @JsonKey(defaultValue: []) final List tags; @JsonKey(name: 'nutrition_per_serving') final NutritionInfo? nutrition; final String source; @JsonKey(name: 'saved_at') final DateTime savedAt; const SavedRecipe({ required this.id, required this.title, this.description, this.cuisine, this.difficulty, this.prepTimeMin, this.cookTimeMin, this.servings, this.imageUrl, this.ingredients = const [], this.steps = const [], this.tags = const [], this.nutrition, required this.source, required this.savedAt, }); factory SavedRecipe.fromJson(Map json) => _$SavedRecipeFromJson(json); Map toJson() => _$SavedRecipeToJson(this); }