classification_config.dart 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131
  1. //
  2. // AUTO-GENERATED FILE, DO NOT MODIFY!
  3. //
  4. // @dart=2.12
  5. // ignore_for_file: unused_element, unused_import
  6. // ignore_for_file: always_put_required_named_parameters_first
  7. // ignore_for_file: constant_identifier_names
  8. // ignore_for_file: lines_longer_than_80_chars
  9. part of openapi.api;
  10. class ClassificationConfig {
  11. /// Returns a new [ClassificationConfig] instance.
  12. ClassificationConfig({
  13. required this.enabled,
  14. required this.minScore,
  15. required this.modelName,
  16. this.modelType,
  17. });
  18. bool enabled;
  19. int minScore;
  20. String modelName;
  21. ///
  22. /// Please note: This property should have been non-nullable! Since the specification file
  23. /// does not include a default value (using the "default:" property), however, the generated
  24. /// source code must fall back to having a nullable type.
  25. /// Consider adding a "default:" property in the specification file to hide this note.
  26. ///
  27. ModelType? modelType;
  28. @override
  29. bool operator ==(Object other) => identical(this, other) || other is ClassificationConfig &&
  30. other.enabled == enabled &&
  31. other.minScore == minScore &&
  32. other.modelName == modelName &&
  33. other.modelType == modelType;
  34. @override
  35. int get hashCode =>
  36. // ignore: unnecessary_parenthesis
  37. (enabled.hashCode) +
  38. (minScore.hashCode) +
  39. (modelName.hashCode) +
  40. (modelType == null ? 0 : modelType!.hashCode);
  41. @override
  42. String toString() => 'ClassificationConfig[enabled=$enabled, minScore=$minScore, modelName=$modelName, modelType=$modelType]';
  43. Map<String, dynamic> toJson() {
  44. final json = <String, dynamic>{};
  45. json[r'enabled'] = this.enabled;
  46. json[r'minScore'] = this.minScore;
  47. json[r'modelName'] = this.modelName;
  48. if (this.modelType != null) {
  49. json[r'modelType'] = this.modelType;
  50. } else {
  51. // json[r'modelType'] = null;
  52. }
  53. return json;
  54. }
  55. /// Returns a new [ClassificationConfig] instance and imports its values from
  56. /// [value] if it's a [Map], null otherwise.
  57. // ignore: prefer_constructors_over_static_methods
  58. static ClassificationConfig? fromJson(dynamic value) {
  59. if (value is Map) {
  60. final json = value.cast<String, dynamic>();
  61. return ClassificationConfig(
  62. enabled: mapValueOfType<bool>(json, r'enabled')!,
  63. minScore: mapValueOfType<int>(json, r'minScore')!,
  64. modelName: mapValueOfType<String>(json, r'modelName')!,
  65. modelType: ModelType.fromJson(json[r'modelType']),
  66. );
  67. }
  68. return null;
  69. }
  70. static List<ClassificationConfig> listFromJson(dynamic json, {bool growable = false,}) {
  71. final result = <ClassificationConfig>[];
  72. if (json is List && json.isNotEmpty) {
  73. for (final row in json) {
  74. final value = ClassificationConfig.fromJson(row);
  75. if (value != null) {
  76. result.add(value);
  77. }
  78. }
  79. }
  80. return result.toList(growable: growable);
  81. }
  82. static Map<String, ClassificationConfig> mapFromJson(dynamic json) {
  83. final map = <String, ClassificationConfig>{};
  84. if (json is Map && json.isNotEmpty) {
  85. json = json.cast<String, dynamic>(); // ignore: parameter_assignments
  86. for (final entry in json.entries) {
  87. final value = ClassificationConfig.fromJson(entry.value);
  88. if (value != null) {
  89. map[entry.key] = value;
  90. }
  91. }
  92. }
  93. return map;
  94. }
  95. // maps a json object with a list of ClassificationConfig-objects as value to a dart map
  96. static Map<String, List<ClassificationConfig>> mapListFromJson(dynamic json, {bool growable = false,}) {
  97. final map = <String, List<ClassificationConfig>>{};
  98. if (json is Map && json.isNotEmpty) {
  99. // ignore: parameter_assignments
  100. json = json.cast<String, dynamic>();
  101. for (final entry in json.entries) {
  102. map[entry.key] = ClassificationConfig.listFromJson(entry.value, growable: growable,);
  103. }
  104. }
  105. return map;
  106. }
  107. /// The list of required keys that must be present in a JSON.
  108. static const requiredKeys = <String>{
  109. 'enabled',
  110. 'minScore',
  111. 'modelName',
  112. };
  113. }