|
| 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 | + |
| 11 | +// ignore_for_file: no_leading_underscores_for_library_prefixes |
| 12 | +import 'package:serverpod_client/serverpod_client.dart' as _i1; |
| 13 | +import '../../../domains/capsules/models/capsule.dart' as _i2; |
| 14 | + |
| 15 | +abstract class CapsuleResource implements _i1.SerializableModel { |
| 16 | + CapsuleResource._({ |
| 17 | + this.id, |
| 18 | + required this.cloudCapsuleId, |
| 19 | + this.capsule, |
| 20 | + required this.computeSize, |
| 21 | + bool? computeScalingEnabled, |
| 22 | + required this.computeResourceQuota, |
| 23 | + }) : computeScalingEnabled = computeScalingEnabled ?? false; |
| 24 | + |
| 25 | + factory CapsuleResource({ |
| 26 | + int? id, |
| 27 | + required int cloudCapsuleId, |
| 28 | + _i2.Capsule? capsule, |
| 29 | + required String computeSize, |
| 30 | + bool? computeScalingEnabled, |
| 31 | + required String computeResourceQuota, |
| 32 | + }) = _CapsuleResourceImpl; |
| 33 | + |
| 34 | + factory CapsuleResource.fromJson(Map<String, dynamic> jsonSerialization) { |
| 35 | + return CapsuleResource( |
| 36 | + id: jsonSerialization['id'] as int?, |
| 37 | + cloudCapsuleId: jsonSerialization['cloudCapsuleId'] as int, |
| 38 | + capsule: jsonSerialization['capsule'] == null |
| 39 | + ? null |
| 40 | + : _i2.Capsule.fromJson( |
| 41 | + (jsonSerialization['capsule'] as Map<String, dynamic>)), |
| 42 | + computeSize: jsonSerialization['computeSize'] as String, |
| 43 | + computeScalingEnabled: jsonSerialization['computeScalingEnabled'] as bool, |
| 44 | + computeResourceQuota: jsonSerialization['computeResourceQuota'] as String, |
| 45 | + ); |
| 46 | + } |
| 47 | + |
| 48 | + /// The database id, set if the object has been inserted into the |
| 49 | + /// database or if it has been fetched from the database. Otherwise, |
| 50 | + /// the id will be null. |
| 51 | + int? id; |
| 52 | + |
| 53 | + /// The foreign key to the capsule. |
| 54 | + int cloudCapsuleId; |
| 55 | + |
| 56 | + /// The capsule this resource config belongs to. |
| 57 | + _i2.Capsule? capsule; |
| 58 | + |
| 59 | + /// The size of the capsule compute. |
| 60 | + String computeSize; |
| 61 | + |
| 62 | + /// Flag to enable horizontal scaling for the capsule compute. |
| 63 | + bool computeScalingEnabled; |
| 64 | + |
| 65 | + /// The resource quota for the capsule compute. |
| 66 | + String computeResourceQuota; |
| 67 | + |
| 68 | + /// Returns a shallow copy of this [CapsuleResource] |
| 69 | + /// with some or all fields replaced by the given arguments. |
| 70 | + @_i1.useResult |
| 71 | + CapsuleResource copyWith({ |
| 72 | + int? id, |
| 73 | + int? cloudCapsuleId, |
| 74 | + _i2.Capsule? capsule, |
| 75 | + String? computeSize, |
| 76 | + bool? computeScalingEnabled, |
| 77 | + String? computeResourceQuota, |
| 78 | + }); |
| 79 | + @override |
| 80 | + Map<String, dynamic> toJson() { |
| 81 | + return { |
| 82 | + if (id != null) 'id': id, |
| 83 | + 'cloudCapsuleId': cloudCapsuleId, |
| 84 | + if (capsule != null) 'capsule': capsule?.toJson(), |
| 85 | + 'computeSize': computeSize, |
| 86 | + 'computeScalingEnabled': computeScalingEnabled, |
| 87 | + 'computeResourceQuota': computeResourceQuota, |
| 88 | + }; |
| 89 | + } |
| 90 | + |
| 91 | + @override |
| 92 | + String toString() { |
| 93 | + return _i1.SerializationManager.encode(this); |
| 94 | + } |
| 95 | +} |
| 96 | + |
| 97 | +class _Undefined {} |
| 98 | + |
| 99 | +class _CapsuleResourceImpl extends CapsuleResource { |
| 100 | + _CapsuleResourceImpl({ |
| 101 | + int? id, |
| 102 | + required int cloudCapsuleId, |
| 103 | + _i2.Capsule? capsule, |
| 104 | + required String computeSize, |
| 105 | + bool? computeScalingEnabled, |
| 106 | + required String computeResourceQuota, |
| 107 | + }) : super._( |
| 108 | + id: id, |
| 109 | + cloudCapsuleId: cloudCapsuleId, |
| 110 | + capsule: capsule, |
| 111 | + computeSize: computeSize, |
| 112 | + computeScalingEnabled: computeScalingEnabled, |
| 113 | + computeResourceQuota: computeResourceQuota, |
| 114 | + ); |
| 115 | + |
| 116 | + /// Returns a shallow copy of this [CapsuleResource] |
| 117 | + /// with some or all fields replaced by the given arguments. |
| 118 | + @_i1.useResult |
| 119 | + @override |
| 120 | + CapsuleResource copyWith({ |
| 121 | + Object? id = _Undefined, |
| 122 | + int? cloudCapsuleId, |
| 123 | + Object? capsule = _Undefined, |
| 124 | + String? computeSize, |
| 125 | + bool? computeScalingEnabled, |
| 126 | + String? computeResourceQuota, |
| 127 | + }) { |
| 128 | + return CapsuleResource( |
| 129 | + id: id is int? ? id : this.id, |
| 130 | + cloudCapsuleId: cloudCapsuleId ?? this.cloudCapsuleId, |
| 131 | + capsule: capsule is _i2.Capsule? ? capsule : this.capsule?.copyWith(), |
| 132 | + computeSize: computeSize ?? this.computeSize, |
| 133 | + computeScalingEnabled: |
| 134 | + computeScalingEnabled ?? this.computeScalingEnabled, |
| 135 | + computeResourceQuota: computeResourceQuota ?? this.computeResourceQuota, |
| 136 | + ); |
| 137 | + } |
| 138 | +} |
0 commit comments