class NotificationModel {
  final int id;
  final int userId;
  final int type;
  final int serviceId;
  final String message;
   final bool isRead; // Add this field
  final String createdDate;
  final List<String> images;

  NotificationModel({
    required this.id,
    required this.userId,
    required this.type,
    required this.serviceId,
     required this.isRead,
    required this.message,
    required this.createdDate,
    required this.images,
  });

  factory NotificationModel.fromJson(Map<String, dynamic> json) {
    // Handle both 'images' and 'images1' fields from API
    List<String> imageList = [];

    if (json['images1'] != null && json['images1'] is List) {
      imageList = List<String>.from(json['images1']);
    }

    return NotificationModel(
      id: json['id'] ?? 0,
      userId: json['user_id'] ?? 0,
      type: json['type'] ?? 0,
        isRead: json['is_read'] ?? false,
      serviceId: json['service_id'] ?? 0,
      message: json['message'] ?? '',
      createdDate: json['created_date'] ?? '',
      images: imageList,
    );
  }

  // ... rest of the class
}
