import '../utils/app_time.dart'; class ChatMessage { ChatMessage({ required this.id, required this.threadId, required this.senderId, required this.body, required this.createdAt, }); final String id; final String threadId; final String senderId; final String body; final DateTime createdAt; factory ChatMessage.fromMap(Map map) { return ChatMessage( id: map['id'] as String, threadId: map['thread_id'] as String, senderId: map['sender_id'] as String, body: map['body'] as String, createdAt: AppTime.parse(map['created_at'] as String), ); } Map toJson() => { 'thread_id': threadId, 'sender_id': senderId, 'body': body, }; }