@override Map<String, Object?> build() => { 'type': type.value, if (metadata != null) 'metadata': metadata!.build(), };