You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
71 lines
1.9 KiB
Dart
71 lines
1.9 KiB
Dart
import 'dart:developer';
|
|
|
|
class ChatParticipantModel {
|
|
int? id;
|
|
String? title;
|
|
String? conversationType;
|
|
List<Participants>? participants;
|
|
dynamic lastMessage;
|
|
String? createdAt;
|
|
int? unreadCount;
|
|
|
|
ChatParticipantModel({this.id, this.title, this.conversationType, this.participants, this.createdAt, this.unreadCount});
|
|
|
|
ChatParticipantModel.fromJson(Map<String, dynamic> json) {
|
|
id = json['id'];
|
|
title = json['title'];
|
|
conversationType = json['conversationType'];
|
|
if (json['participants'] != null) {
|
|
participants = <Participants>[];
|
|
json['participants'].forEach((v) {
|
|
participants!.add(new Participants.fromJson(v));
|
|
});
|
|
}
|
|
lastMessage = json['lastMessage'];
|
|
createdAt = json['createdAt'];
|
|
unreadCount = json['unreadCount'];
|
|
}
|
|
|
|
Map<String, dynamic> toJson() {
|
|
final Map<String, dynamic> data = <String, dynamic>{};
|
|
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<String, dynamic> json) {
|
|
userId = json['userId'];
|
|
userName = json['userName'];
|
|
employeeNumber = json['employeeNumber'];
|
|
role = json['role'];
|
|
userStatus = json['userStatus'];
|
|
}
|
|
|
|
Map<String, dynamic> toJson() {
|
|
final Map<String, dynamic> data = <String, dynamic>{};
|
|
data['userId'] = userId;
|
|
data['userName'] = userName;
|
|
data['employeeNumber'] = employeeNumber;
|
|
data['role'] = role;
|
|
data['userStatus'] = userStatus;
|
|
return data;
|
|
}
|
|
}
|