81 lines
2.3 KiB
Dart
81 lines
2.3 KiB
Dart
import 'dart:convert';
|
|
|
|
ChatProfileModel chatProfileModelFromJson(String str) =>
|
|
ChatProfileModel.fromJson(json.decode(str));
|
|
|
|
String chatProfileModelToJson(ChatProfileModel data) =>
|
|
json.encode(data.toJson());
|
|
|
|
class ChatProfileModel {
|
|
final bool status;
|
|
final String profile;
|
|
final String name;
|
|
final String role;
|
|
final List<ChatDocument> userUploadedDocuments;
|
|
final List<ChatDocument> adminUploadedDocuments;
|
|
|
|
ChatProfileModel({
|
|
required this.status,
|
|
required this.profile,
|
|
required this.name,
|
|
required this.role,
|
|
required this.userUploadedDocuments,
|
|
required this.adminUploadedDocuments,
|
|
});
|
|
|
|
factory ChatProfileModel.fromJson(Map<String, dynamic> json) =>
|
|
ChatProfileModel(
|
|
status: json["status"] ?? false,
|
|
profile: json["profile"] ?? "",
|
|
name: json["name"] ?? "",
|
|
role: json["role"] ?? "",
|
|
userUploadedDocuments: json["userUploadedDocuments"] == null
|
|
? []
|
|
: List<ChatDocument>.from(
|
|
json["userUploadedDocuments"]
|
|
.map((x) => ChatDocument.fromJson(x)),
|
|
),
|
|
adminUploadedDocuments: json["adminUploadedDocuments"] == null
|
|
? []
|
|
: List<ChatDocument>.from(
|
|
json["adminUploadedDocuments"]
|
|
.map((x) => ChatDocument.fromJson(x)),
|
|
),
|
|
);
|
|
|
|
Map<String, dynamic> toJson() => {
|
|
"status": status,
|
|
"profile": profile,
|
|
"name": name,
|
|
"role": role,
|
|
"userUploadedDocuments":
|
|
userUploadedDocuments.map((x) => x.toJson()).toList(),
|
|
"adminUploadedDocuments":
|
|
adminUploadedDocuments.map((x) => x.toJson()).toList(),
|
|
};
|
|
}
|
|
|
|
class ChatDocument {
|
|
final String fileName;
|
|
final String filePath;
|
|
final String fileType;
|
|
|
|
ChatDocument({
|
|
required this.fileName,
|
|
required this.filePath,
|
|
required this.fileType,
|
|
});
|
|
|
|
factory ChatDocument.fromJson(Map<String, dynamic> json) => ChatDocument(
|
|
fileName: json["file_name"] ?? "",
|
|
filePath: json["file_path"] ?? "",
|
|
fileType: json["file_type"] ?? "",
|
|
);
|
|
|
|
Map<String, dynamic> toJson() => {
|
|
"file_name": fileName,
|
|
"file_path": filePath,
|
|
"file_type": fileType,
|
|
};
|
|
}
|