|
| 1 | +/* AUTOMATICALLY GENERATED CODE DO NOT MODIFY */ |
| 2 | +/* To generate run: "serverpod generate" */ |
| 3 | + |
| 4 | +// ignore_for_file: implementation_imports |
| 5 | +// ignore_for_file: library_private_types_in_public_api |
| 6 | +// ignore_for_file: non_constant_identifier_names |
| 7 | +// ignore_for_file: public_member_api_docs |
| 8 | +// ignore_for_file: type_literal_in_constant_pattern |
| 9 | +// ignore_for_file: use_super_parameters |
| 10 | +// ignore_for_file: invalid_use_of_internal_member |
| 11 | + |
| 12 | +// ignore_for_file: no_leading_underscores_for_library_prefixes |
| 13 | +import 'package:serverpod_client/serverpod_client.dart' as _i1; |
| 14 | +import 'package:ground_control_client/src/protocol/protocol.dart' as _i2; |
| 15 | + |
| 16 | +/// Definition of a compute product including defaults and constraints. |
| 17 | +abstract class ComputeProductInfo implements _i1.SerializableModel { |
| 18 | + ComputeProductInfo._({ |
| 19 | + required this.productId, |
| 20 | + required this.name, |
| 21 | + required this.description, |
| 22 | + required this.defaultInstanceType, |
| 23 | + required this.defaultMinReplicas, |
| 24 | + required this.defaultMaxReplicas, |
| 25 | + required this.allowedInstanceTypes, |
| 26 | + required this.allowedReplicasMin, |
| 27 | + required this.allowedReplicasMax, |
| 28 | + }); |
| 29 | + |
| 30 | + factory ComputeProductInfo({ |
| 31 | + required String productId, |
| 32 | + required String name, |
| 33 | + required String description, |
| 34 | + required String defaultInstanceType, |
| 35 | + required int defaultMinReplicas, |
| 36 | + required int defaultMaxReplicas, |
| 37 | + required List<String> allowedInstanceTypes, |
| 38 | + required int allowedReplicasMin, |
| 39 | + required int allowedReplicasMax, |
| 40 | + }) = _ComputeProductInfoImpl; |
| 41 | + |
| 42 | + factory ComputeProductInfo.fromJson(Map<String, dynamic> jsonSerialization) { |
| 43 | + return ComputeProductInfo( |
| 44 | + productId: jsonSerialization['productId'] as String, |
| 45 | + name: jsonSerialization['name'] as String, |
| 46 | + description: jsonSerialization['description'] as String, |
| 47 | + defaultInstanceType: jsonSerialization['defaultInstanceType'] as String, |
| 48 | + defaultMinReplicas: jsonSerialization['defaultMinReplicas'] as int, |
| 49 | + defaultMaxReplicas: jsonSerialization['defaultMaxReplicas'] as int, |
| 50 | + allowedInstanceTypes: _i2.Protocol().deserialize<List<String>>( |
| 51 | + jsonSerialization['allowedInstanceTypes'], |
| 52 | + ), |
| 53 | + allowedReplicasMin: jsonSerialization['allowedReplicasMin'] as int, |
| 54 | + allowedReplicasMax: jsonSerialization['allowedReplicasMax'] as int, |
| 55 | + ); |
| 56 | + } |
| 57 | + |
| 58 | + /// The id of the product. |
| 59 | + String productId; |
| 60 | + |
| 61 | + /// The user-friendly name of the product. |
| 62 | + String name; |
| 63 | + |
| 64 | + /// The user-friendly description of the product. |
| 65 | + String description; |
| 66 | + |
| 67 | + /// The default instance type name. |
| 68 | + String defaultInstanceType; |
| 69 | + |
| 70 | + /// The default minimum number of replicas. |
| 71 | + int defaultMinReplicas; |
| 72 | + |
| 73 | + /// The default maximum number of replicas. |
| 74 | + int defaultMaxReplicas; |
| 75 | + |
| 76 | + /// The allowed instance type names. |
| 77 | + List<String> allowedInstanceTypes; |
| 78 | + |
| 79 | + /// The minimum number of replicas allowed. |
| 80 | + int allowedReplicasMin; |
| 81 | + |
| 82 | + /// The maximum number of replicas allowed. |
| 83 | + int allowedReplicasMax; |
| 84 | + |
| 85 | + /// Returns a shallow copy of this [ComputeProductInfo] |
| 86 | + /// with some or all fields replaced by the given arguments. |
| 87 | + @_i1.useResult |
| 88 | + ComputeProductInfo copyWith({ |
| 89 | + String? productId, |
| 90 | + String? name, |
| 91 | + String? description, |
| 92 | + String? defaultInstanceType, |
| 93 | + int? defaultMinReplicas, |
| 94 | + int? defaultMaxReplicas, |
| 95 | + List<String>? allowedInstanceTypes, |
| 96 | + int? allowedReplicasMin, |
| 97 | + int? allowedReplicasMax, |
| 98 | + }); |
| 99 | + @override |
| 100 | + Map<String, dynamic> toJson() { |
| 101 | + return { |
| 102 | + '__className__': 'ComputeProductInfo', |
| 103 | + 'productId': productId, |
| 104 | + 'name': name, |
| 105 | + 'description': description, |
| 106 | + 'defaultInstanceType': defaultInstanceType, |
| 107 | + 'defaultMinReplicas': defaultMinReplicas, |
| 108 | + 'defaultMaxReplicas': defaultMaxReplicas, |
| 109 | + 'allowedInstanceTypes': allowedInstanceTypes.toJson(), |
| 110 | + 'allowedReplicasMin': allowedReplicasMin, |
| 111 | + 'allowedReplicasMax': allowedReplicasMax, |
| 112 | + }; |
| 113 | + } |
| 114 | + |
| 115 | + @override |
| 116 | + String toString() { |
| 117 | + return _i1.SerializationManager.encode(this); |
| 118 | + } |
| 119 | +} |
| 120 | + |
| 121 | +class _ComputeProductInfoImpl extends ComputeProductInfo { |
| 122 | + _ComputeProductInfoImpl({ |
| 123 | + required String productId, |
| 124 | + required String name, |
| 125 | + required String description, |
| 126 | + required String defaultInstanceType, |
| 127 | + required int defaultMinReplicas, |
| 128 | + required int defaultMaxReplicas, |
| 129 | + required List<String> allowedInstanceTypes, |
| 130 | + required int allowedReplicasMin, |
| 131 | + required int allowedReplicasMax, |
| 132 | + }) : super._( |
| 133 | + productId: productId, |
| 134 | + name: name, |
| 135 | + description: description, |
| 136 | + defaultInstanceType: defaultInstanceType, |
| 137 | + defaultMinReplicas: defaultMinReplicas, |
| 138 | + defaultMaxReplicas: defaultMaxReplicas, |
| 139 | + allowedInstanceTypes: allowedInstanceTypes, |
| 140 | + allowedReplicasMin: allowedReplicasMin, |
| 141 | + allowedReplicasMax: allowedReplicasMax, |
| 142 | + ); |
| 143 | + |
| 144 | + /// Returns a shallow copy of this [ComputeProductInfo] |
| 145 | + /// with some or all fields replaced by the given arguments. |
| 146 | + @_i1.useResult |
| 147 | + @override |
| 148 | + ComputeProductInfo copyWith({ |
| 149 | + String? productId, |
| 150 | + String? name, |
| 151 | + String? description, |
| 152 | + String? defaultInstanceType, |
| 153 | + int? defaultMinReplicas, |
| 154 | + int? defaultMaxReplicas, |
| 155 | + List<String>? allowedInstanceTypes, |
| 156 | + int? allowedReplicasMin, |
| 157 | + int? allowedReplicasMax, |
| 158 | + }) { |
| 159 | + return ComputeProductInfo( |
| 160 | + productId: productId ?? this.productId, |
| 161 | + name: name ?? this.name, |
| 162 | + description: description ?? this.description, |
| 163 | + defaultInstanceType: defaultInstanceType ?? this.defaultInstanceType, |
| 164 | + defaultMinReplicas: defaultMinReplicas ?? this.defaultMinReplicas, |
| 165 | + defaultMaxReplicas: defaultMaxReplicas ?? this.defaultMaxReplicas, |
| 166 | + allowedInstanceTypes: |
| 167 | + allowedInstanceTypes ?? |
| 168 | + this.allowedInstanceTypes.map((e0) => e0).toList(), |
| 169 | + allowedReplicasMin: allowedReplicasMin ?? this.allowedReplicasMin, |
| 170 | + allowedReplicasMax: allowedReplicasMax ?? this.allowedReplicasMax, |
| 171 | + ); |
| 172 | + } |
| 173 | +} |
0 commit comments