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.
66 lines
1.9 KiB
Dart
66 lines
1.9 KiB
Dart
|
2 months ago
|
class ChatParticipantModel {
|
||
|
|
int? id;
|
||
|
|
String? title;
|
||
|
|
String? conversationType;
|
||
|
|
List<Participants>? participants;
|
||
|
|
String? lastMessage;
|
||
|
|
String? createdAt;
|
||
|
|
|
||
|
|
ChatParticipantModel({this.id, this.title, this.conversationType, this.participants, this.lastMessage, this.createdAt});
|
||
|
|
|
||
|
|
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'];
|
||
|
|
}
|
||
|
|
|
||
|
|
Map<String, dynamic> toJson() {
|
||
|
|
final Map<String, dynamic> data = new Map<String, dynamic>();
|
||
|
|
data['id'] = this.id;
|
||
|
|
data['title'] = this.title;
|
||
|
|
data['conversationType'] = this.conversationType;
|
||
|
|
if (this.participants != null) {
|
||
|
|
data['participants'] = this.participants!.map((v) => v.toJson()).toList();
|
||
|
|
}
|
||
|
|
data['lastMessage'] = this.lastMessage;
|
||
|
|
data['createdAt'] = this.createdAt;
|
||
|
|
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 = new Map<String, dynamic>();
|
||
|
|
data['userId'] = this.userId;
|
||
|
|
data['userName'] = this.userName;
|
||
|
|
data['employeeNumber'] = this.employeeNumber;
|
||
|
|
data['role'] = this.role;
|
||
|
|
data['userStatus'] = this.userStatus;
|
||
|
|
return data;
|
||
|
|
}
|
||
|
|
}
|