tablet-app/manager_api_new/lib/model/user_detail_dto.dart
Thomas Fransolet 0cd2b47211 WIP Version 3.0
2025-05-23 17:07:04 +02:00

169 lines
4.6 KiB
Dart

//
// AUTO-GENERATED FILE, DO NOT MODIFY!
//
// @dart=2.18
// ignore_for_file: unused_element, unused_import
// ignore_for_file: always_put_required_named_parameters_first
// ignore_for_file: constant_identifier_names
// ignore_for_file: lines_longer_than_80_chars
part of openapi.api;
class UserDetailDTO {
/// Returns a new [UserDetailDTO] instance.
UserDetailDTO({
this.id,
this.email,
this.firstName,
this.lastName,
this.instanceId,
});
String? id;
String? email;
String? firstName;
String? lastName;
String? instanceId;
@override
bool operator ==(Object other) =>
identical(this, other) ||
other is UserDetailDTO &&
other.id == id &&
other.email == email &&
other.firstName == firstName &&
other.lastName == lastName &&
other.instanceId == instanceId;
@override
int get hashCode =>
// ignore: unnecessary_parenthesis
(id == null ? 0 : id!.hashCode) +
(email == null ? 0 : email!.hashCode) +
(firstName == null ? 0 : firstName!.hashCode) +
(lastName == null ? 0 : lastName!.hashCode) +
(instanceId == null ? 0 : instanceId!.hashCode);
@override
String toString() =>
'UserDetailDTO[id=$id, email=$email, firstName=$firstName, lastName=$lastName, instanceId=$instanceId]';
Map<String, dynamic> toJson() {
final json = <String, dynamic>{};
if (this.id != null) {
json[r'id'] = this.id;
} else {
json[r'id'] = null;
}
if (this.email != null) {
json[r'email'] = this.email;
} else {
json[r'email'] = null;
}
if (this.firstName != null) {
json[r'firstName'] = this.firstName;
} else {
json[r'firstName'] = null;
}
if (this.lastName != null) {
json[r'lastName'] = this.lastName;
} else {
json[r'lastName'] = null;
}
if (this.instanceId != null) {
json[r'instanceId'] = this.instanceId;
} else {
json[r'instanceId'] = null;
}
return json;
}
/// Returns a new [UserDetailDTO] instance and imports its values from
/// [value] if it's a [Map], null otherwise.
// ignore: prefer_constructors_over_static_methods
static UserDetailDTO? fromJson(dynamic value) {
if (value is Map) {
final json = value.cast<String, dynamic>();
// Ensure that the map contains the required keys.
// Note 1: the values aren't checked for validity beyond being non-null.
// Note 2: this code is stripped in release mode!
assert(() {
requiredKeys.forEach((key) {
assert(json.containsKey(key),
'Required key "UserDetailDTO[$key]" is missing from JSON.');
assert(json[key] != null,
'Required key "UserDetailDTO[$key]" has a null value in JSON.');
});
return true;
}());
return UserDetailDTO(
id: mapValueOfType<String>(json, r'id'),
email: mapValueOfType<String>(json, r'email'),
firstName: mapValueOfType<String>(json, r'firstName'),
lastName: mapValueOfType<String>(json, r'lastName'),
instanceId: mapValueOfType<String>(json, r'instanceId'),
);
}
return null;
}
static List<UserDetailDTO> listFromJson(
dynamic json, {
bool growable = false,
}) {
final result = <UserDetailDTO>[];
if (json is List && json.isNotEmpty) {
for (final row in json) {
final value = UserDetailDTO.fromJson(row);
if (value != null) {
result.add(value);
}
}
}
return result.toList(growable: growable);
}
static Map<String, UserDetailDTO> mapFromJson(dynamic json) {
final map = <String, UserDetailDTO>{};
if (json is Map && json.isNotEmpty) {
json = json.cast<String, dynamic>(); // ignore: parameter_assignments
for (final entry in json.entries) {
final value = UserDetailDTO.fromJson(entry.value);
if (value != null) {
map[entry.key] = value;
}
}
}
return map;
}
// maps a json object with a list of UserDetailDTO-objects as value to a dart map
static Map<String, List<UserDetailDTO>> mapListFromJson(
dynamic json, {
bool growable = false,
}) {
final map = <String, List<UserDetailDTO>>{};
if (json is Map && json.isNotEmpty) {
// ignore: parameter_assignments
json = json.cast<String, dynamic>();
for (final entry in json.entries) {
map[entry.key] = UserDetailDTO.listFromJson(
entry.value,
growable: growable,
);
}
}
return map;
}
/// The list of required keys that must be present in a JSON.
static const requiredKeys = <String>{};
}