import 'package:equatable/equatable.dart'; class ContactModel extends Equatable { // English: Unique identifier for the contact. // Arabic: المعرف الفريد لجهة الاتصال. final int id; // English: Name of the contact. // Arabic: اسم جهة الاتصال. final String name; // English: Phone number. // Arabic: رقم الهاتف. final String phone; // English: Optional email address. // Arabic: البريد الإلكتروني الاختياري. final String? email; // English: Optional descriptive notes. // Arabic: ملاحظات وصفية اختيارية. final String? notes; const ContactModel({ required this.id, required this.name, required this.phone, this.email, this.notes, }); // English: Factory constructor to parse ContactModel from JSON map. // Arabic: منشئ المصنع لتحليل نموذج جهة الاتصال من خريطة جيسون. factory ContactModel.fromJson(Map json) { return ContactModel( id: json['id'] as int? ?? 0, name: json['name'] as String? ?? '', phone: json['phone'] as String? ?? '', email: json['email'] as String?, notes: json['notes'] as String?, ); } // English: Convert model to JSON map. // Arabic: تحويل النموذج إلى خريطة جيسون. Map toJson() { return { 'id': id, 'name': name, 'phone': phone, 'email': email, 'notes': notes, }; } @override List get props => [id, name, phone, email, notes]; }