Map<String, dynamic> toJson() { return { 'type': type.value, 'sender': sender?.toJson(), 'chat_id': chatId, 'message': message.toJson(), }; }