Convert the message to a JSON map
@override Map<String, dynamic> toJson() { return { 'type': type.value, 'documentId': documentId, 'changes': changes.map((c) => c.toJson()).toList(), }; }