import 'package:muaawana/models/auth/current_user_response.dart'; class MessageModel{ int? id; String? chatId; CurrentUser? sender; CurrentUser? recipient; String? senderName; String? recipientName; String? content; int? timestamp; String? imagePicture; String? status; MessageModel({ this.id, this.chatId, this.sender, this.recipient, this.senderName, this.recipientName, this.content, this.imagePicture, this.timestamp, this.status, }); factory MessageModel.fromJson(Map json) => MessageModel( id: json["id"], chatId: json["chatId"], sender: CurrentUser.fromJson(json["sender"]), recipient: CurrentUser.fromJson(json["recipient"]), senderName: json["senderName"], recipientName: json["recipientName"], content: json["content"], timestamp: json["timestamp"], status: json["status"], ); Map toJson() => { "id": id, "chatId": chatId, "sender": sender?.toJson(), "recipient": recipient?.toJson(), "senderName": senderName, "recipientName": recipientName, "content": content, "timestamp": timestamp, "status": status, }; }