diff --git a/creche_app/lib/models/child.dart b/creche_app/lib/models/child.dart deleted file mode 100644 index 3503bc8..0000000 --- a/creche_app/lib/models/child.dart +++ /dev/null @@ -1,70 +0,0 @@ -import 'package:uuid/uuid.dart'; - -class Child { - final String id; - final String firstName; - final String lastName; - final DateTime birthDate; - final String? photoUrl; - final String classId; - final String teacherId; - final String status; - final String? mood; - final String? allergies; // ← NOVO - final String? foodRestrictions; // ← NOVO - final String? roomId; // ← NOVO - - Child({ - String? id, - required this.firstName, - required this.lastName, - required this.birthDate, - this.photoUrl, - required this.classId, - required this.teacherId, - this.status = 'active', - this.mood, - this.allergies, - this.foodRestrictions, - this.roomId, - }) : id = id ?? const Uuid().v4(); - - int get age { - final today = DateTime.now(); - int a = today.year - birthDate.year; - if (today.month < birthDate.month || - (today.month == birthDate.month && today.day < birthDate.day)) a--; - return a; - } - - String get fullName => '$firstName $lastName'; - - factory Child.fromMap(Map map) => Child( - id: map['id'], - firstName: map['first_name'] ?? '', - lastName: map['last_name'] ?? '', - birthDate: DateTime.tryParse(map['birth_date'] ?? '') ?? DateTime.now(), - photoUrl: map['photo_url'], - classId: map['class_id'] ?? '', - teacherId: map['teacher_id'] ?? '', - status: map['status'] ?? 'active', - mood: map['mood'], - allergies: map['allergies'], - foodRestrictions: map['food_restrictions'], - roomId: map['room_id'], - ); - - Map toMap() => { - 'id': id, - 'first_name': firstName, - 'last_name': lastName, - 'birth_date': birthDate.toIso8601String().split('T')[0], - 'photo_url': photoUrl, - 'class_id': classId, - 'teacher_id': teacherId, - 'status': status, - 'allergies': allergies, - 'food_restrictions': foodRestrictions, - 'room_id': roomId, - }; -}