Skip to content

Commit 5dc90b8

Browse files
author
serverpod_cloud
committed
feat: 9d14edb4cf205571378627a567587c98f236598c
1 parent 3034724 commit 5dc90b8

4 files changed

Lines changed: 515 additions & 424 deletions

File tree

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
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+
15+
enum BillingCustomerType implements _i1.SerializableModel {
16+
private,
17+
business;
18+
19+
static BillingCustomerType fromJson(String name) {
20+
switch (name) {
21+
case 'private':
22+
return BillingCustomerType.private;
23+
case 'business':
24+
return BillingCustomerType.business;
25+
default:
26+
throw ArgumentError(
27+
'Value "$name" cannot be converted to "BillingCustomerType"');
28+
}
29+
}
30+
31+
@override
32+
String toJson() => name;
33+
34+
@override
35+
String toString() => name;
36+
}

ground_control_client/lib/src/protocol/domains/billing/models/billing_info.dart

Lines changed: 33 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,8 @@
1111

1212
// ignore_for_file: no_leading_underscores_for_library_prefixes
1313
import 'package:serverpod_client/serverpod_client.dart' as _i1;
14-
import '../../../domains/billing/models/owner.dart' as _i2;
14+
import '../../../domains/billing/models/billing_customer_type.dart' as _i2;
15+
import '../../../domains/billing/models/owner.dart' as _i3;
1516

1617
abstract class BillingInfo implements _i1.SerializableModel {
1718
BillingInfo._({
@@ -28,14 +29,17 @@ abstract class BillingInfo implements _i1.SerializableModel {
2829
this.state,
2930
required this.country,
3031
this.vatNumber,
31-
}) : id = id ?? _i1.Uuid().v4obj();
32+
this.vatType,
33+
_i2.BillingCustomerType? customerType,
34+
}) : id = id ?? _i1.Uuid().v4obj(),
35+
customerType = customerType ?? _i2.BillingCustomerType.private;
3236

3337
factory BillingInfo({
3438
_i1.UuidValue? id,
3539
DateTime? createdAt,
3640
DateTime? updatedAt,
3741
required _i1.UuidValue ownerId,
38-
_i2.Owner? owner,
42+
_i3.Owner? owner,
3943
String? companyName,
4044
required String addressLine1,
4145
String? addressLine2,
@@ -44,6 +48,8 @@ abstract class BillingInfo implements _i1.SerializableModel {
4448
String? state,
4549
required String country,
4650
String? vatNumber,
51+
String? vatType,
52+
_i2.BillingCustomerType? customerType,
4753
}) = _BillingInfoImpl;
4854

4955
factory BillingInfo.fromJson(Map<String, dynamic> jsonSerialization) {
@@ -59,7 +65,7 @@ abstract class BillingInfo implements _i1.SerializableModel {
5965
_i1.UuidValueJsonExtension.fromJson(jsonSerialization['ownerId']),
6066
owner: jsonSerialization['owner'] == null
6167
? null
62-
: _i2.Owner.fromJson(
68+
: _i3.Owner.fromJson(
6369
(jsonSerialization['owner'] as Map<String, dynamic>)),
6470
companyName: jsonSerialization['companyName'] as String?,
6571
addressLine1: jsonSerialization['addressLine1'] as String,
@@ -69,6 +75,9 @@ abstract class BillingInfo implements _i1.SerializableModel {
6975
state: jsonSerialization['state'] as String?,
7076
country: jsonSerialization['country'] as String,
7177
vatNumber: jsonSerialization['vatNumber'] as String?,
78+
vatType: jsonSerialization['vatType'] as String?,
79+
customerType: _i2.BillingCustomerType.fromJson(
80+
(jsonSerialization['customerType'] as String)),
7281
);
7382
}
7483

@@ -83,7 +92,7 @@ abstract class BillingInfo implements _i1.SerializableModel {
8392

8493
_i1.UuidValue ownerId;
8594

86-
_i2.Owner? owner;
95+
_i3.Owner? owner;
8796

8897
String? companyName;
8998

@@ -101,6 +110,10 @@ abstract class BillingInfo implements _i1.SerializableModel {
101110

102111
String? vatNumber;
103112

113+
String? vatType;
114+
115+
_i2.BillingCustomerType customerType;
116+
104117
/// Returns a shallow copy of this [BillingInfo]
105118
/// with some or all fields replaced by the given arguments.
106119
@_i1.useResult
@@ -109,7 +122,7 @@ abstract class BillingInfo implements _i1.SerializableModel {
109122
DateTime? createdAt,
110123
DateTime? updatedAt,
111124
_i1.UuidValue? ownerId,
112-
_i2.Owner? owner,
125+
_i3.Owner? owner,
113126
String? companyName,
114127
String? addressLine1,
115128
String? addressLine2,
@@ -118,6 +131,8 @@ abstract class BillingInfo implements _i1.SerializableModel {
118131
String? state,
119132
String? country,
120133
String? vatNumber,
134+
String? vatType,
135+
_i2.BillingCustomerType? customerType,
121136
});
122137
@override
123138
Map<String, dynamic> toJson() {
@@ -135,6 +150,8 @@ abstract class BillingInfo implements _i1.SerializableModel {
135150
if (state != null) 'state': state,
136151
'country': country,
137152
if (vatNumber != null) 'vatNumber': vatNumber,
153+
if (vatType != null) 'vatType': vatType,
154+
'customerType': customerType.toJson(),
138155
};
139156
}
140157

@@ -152,7 +169,7 @@ class _BillingInfoImpl extends BillingInfo {
152169
DateTime? createdAt,
153170
DateTime? updatedAt,
154171
required _i1.UuidValue ownerId,
155-
_i2.Owner? owner,
172+
_i3.Owner? owner,
156173
String? companyName,
157174
required String addressLine1,
158175
String? addressLine2,
@@ -161,6 +178,8 @@ class _BillingInfoImpl extends BillingInfo {
161178
String? state,
162179
required String country,
163180
String? vatNumber,
181+
String? vatType,
182+
_i2.BillingCustomerType? customerType,
164183
}) : super._(
165184
id: id,
166185
createdAt: createdAt,
@@ -175,6 +194,8 @@ class _BillingInfoImpl extends BillingInfo {
175194
state: state,
176195
country: country,
177196
vatNumber: vatNumber,
197+
vatType: vatType,
198+
customerType: customerType,
178199
);
179200

180201
/// Returns a shallow copy of this [BillingInfo]
@@ -195,13 +216,15 @@ class _BillingInfoImpl extends BillingInfo {
195216
Object? state = _Undefined,
196217
String? country,
197218
Object? vatNumber = _Undefined,
219+
Object? vatType = _Undefined,
220+
_i2.BillingCustomerType? customerType,
198221
}) {
199222
return BillingInfo(
200223
id: id ?? this.id,
201224
createdAt: createdAt is DateTime? ? createdAt : this.createdAt,
202225
updatedAt: updatedAt is DateTime? ? updatedAt : this.updatedAt,
203226
ownerId: ownerId ?? this.ownerId,
204-
owner: owner is _i2.Owner? ? owner : this.owner?.copyWith(),
227+
owner: owner is _i3.Owner? ? owner : this.owner?.copyWith(),
205228
companyName: companyName is String? ? companyName : this.companyName,
206229
addressLine1: addressLine1 ?? this.addressLine1,
207230
addressLine2: addressLine2 is String? ? addressLine2 : this.addressLine2,
@@ -210,6 +233,8 @@ class _BillingInfoImpl extends BillingInfo {
210233
state: state is String? ? state : this.state,
211234
country: country ?? this.country,
212235
vatNumber: vatNumber is String? ? vatNumber : this.vatNumber,
236+
vatType: vatType is String? ? vatType : this.vatType,
237+
customerType: customerType ?? this.customerType,
213238
);
214239
}
215240
}

0 commit comments

Comments
 (0)