import 'dart:developer'; class ChatParticipantModel { int? id; String? title; String? conversationType; List? participants; dynamic lastMessage; String? createdAt; int? unreadCount; ChatParticipantModel({this.id, this.title, this.conversationType, this.participants, this.createdAt, this.unreadCount}); ChatParticipantModel.fromJson(Map json) { id = json['id']; title = json['title']; conversationType = json['conversationType']; if (json['participants'] != null) { participants = []; json['participants'].forEach((v) { participants!.add(new Participants.fromJson(v)); }); } lastMessage = json['lastMessage']; createdAt = json['createdAt']; unreadCount = json['unreadCount']; } Map toJson() { final Map data = {}; data['id'] = id; data['title'] = title; data['conversationType'] = conversationType; if (participants != null) { data['participants'] = participants!.map((v) => v.toJson()).toList(); } data['lastMessage'] = lastMessage; data['createdAt'] = createdAt; data['unreadCount'] = unreadCount; return data; } } class Participants { String? userId; String? userName; String? employeeNumber; String? role; int? userStatus; Participants({this.userId, this.userName, this.employeeNumber, this.role, this.userStatus}); Participants.fromJson(Map json) { userId = json['userId']; userName = json['userName']; employeeNumber = json['employeeNumber']; role = json['role']; userStatus = json['userStatus']; } Map toJson() { final Map data = {}; data['userId'] = userId; data['userName'] = userName; data['employeeNumber'] = employeeNumber; data['role'] = role; data['userStatus'] = userStatus; return data; } }