|
| 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 '../../../../features/project/models/project.dart' as _i2; |
| 15 | +import '../../../../features/project/models/project_info/timestamp.dart' as _i3; |
| 16 | + |
| 17 | +/// Augments a project object with ancillary information. |
| 18 | +/// |
| 19 | +/// Ancillary information fields are included according to use case, |
| 20 | +/// in which case they are non-null. |
| 21 | +/// In other words, null ancillary fields correspond to `undefined`. |
| 22 | +abstract class ProjectInfo implements _i1.SerializableModel { |
| 23 | + ProjectInfo._({ |
| 24 | + required this.project, |
| 25 | + this.latestDeployAttemptTime, |
| 26 | + }); |
| 27 | + |
| 28 | + factory ProjectInfo({ |
| 29 | + required _i2.Project project, |
| 30 | + _i3.Timestamp? latestDeployAttemptTime, |
| 31 | + }) = _ProjectInfoImpl; |
| 32 | + |
| 33 | + factory ProjectInfo.fromJson(Map<String, dynamic> jsonSerialization) { |
| 34 | + return ProjectInfo( |
| 35 | + project: _i2.Project.fromJson( |
| 36 | + (jsonSerialization['project'] as Map<String, dynamic>)), |
| 37 | + latestDeployAttemptTime: jsonSerialization['latestDeployAttemptTime'] == |
| 38 | + null |
| 39 | + ? null |
| 40 | + : _i3.Timestamp.fromJson((jsonSerialization['latestDeployAttemptTime'] |
| 41 | + as Map<String, dynamic>)), |
| 42 | + ); |
| 43 | + } |
| 44 | + |
| 45 | + _i2.Project project; |
| 46 | + |
| 47 | + /// The timestamp of the latest deploy attempt, or null if never deployed. |
| 48 | + /// (When deploy status is overhauled, this will likely be replaced by a |
| 49 | + /// `DeployAttempt` object.) |
| 50 | + _i3.Timestamp? latestDeployAttemptTime; |
| 51 | + |
| 52 | + /// Returns a shallow copy of this [ProjectInfo] |
| 53 | + /// with some or all fields replaced by the given arguments. |
| 54 | + @_i1.useResult |
| 55 | + ProjectInfo copyWith({ |
| 56 | + _i2.Project? project, |
| 57 | + _i3.Timestamp? latestDeployAttemptTime, |
| 58 | + }); |
| 59 | + @override |
| 60 | + Map<String, dynamic> toJson() { |
| 61 | + return { |
| 62 | + 'project': project.toJson(), |
| 63 | + if (latestDeployAttemptTime != null) |
| 64 | + 'latestDeployAttemptTime': latestDeployAttemptTime?.toJson(), |
| 65 | + }; |
| 66 | + } |
| 67 | + |
| 68 | + @override |
| 69 | + String toString() { |
| 70 | + return _i1.SerializationManager.encode(this); |
| 71 | + } |
| 72 | +} |
| 73 | + |
| 74 | +class _Undefined {} |
| 75 | + |
| 76 | +class _ProjectInfoImpl extends ProjectInfo { |
| 77 | + _ProjectInfoImpl({ |
| 78 | + required _i2.Project project, |
| 79 | + _i3.Timestamp? latestDeployAttemptTime, |
| 80 | + }) : super._( |
| 81 | + project: project, |
| 82 | + latestDeployAttemptTime: latestDeployAttemptTime, |
| 83 | + ); |
| 84 | + |
| 85 | + /// Returns a shallow copy of this [ProjectInfo] |
| 86 | + /// with some or all fields replaced by the given arguments. |
| 87 | + @_i1.useResult |
| 88 | + @override |
| 89 | + ProjectInfo copyWith({ |
| 90 | + _i2.Project? project, |
| 91 | + Object? latestDeployAttemptTime = _Undefined, |
| 92 | + }) { |
| 93 | + return ProjectInfo( |
| 94 | + project: project ?? this.project.copyWith(), |
| 95 | + latestDeployAttemptTime: latestDeployAttemptTime is _i3.Timestamp? |
| 96 | + ? latestDeployAttemptTime |
| 97 | + : this.latestDeployAttemptTime?.copyWith(), |
| 98 | + ); |
| 99 | + } |
| 100 | +} |
0 commit comments