Serializes to a map.
Map<String, Object?> toMap() { return <String, Object?>{'type': type.name, 'confidence': confidence.name}; }