tablet-app/manager_api/lib/model/device_detail_dto.dart

168 lines
5.4 KiB
Dart

//
// AUTO-GENERATED FILE, DO NOT MODIFY!
//
// @dart=2.0
// ignore_for_file: unused_element, unused_import
// ignore_for_file: always_put_required_named_parameters_first
// ignore_for_file: lines_longer_than_80_chars
part of openapi.api;
class DeviceDetailDTO {
/// Returns a new [DeviceDetailDTO] instance.
DeviceDetailDTO({
this.id,
this.name,
this.ipAddress,
this.configurationId,
this.configuration,
this.connected,
this.dateCreation,
this.connectionLevel,
this.lastConnectionLevel,
this.batteryLevel,
this.lastBatteryLevel,
});
String id;
String name;
String ipAddress;
String configurationId;
String configuration;
bool connected;
DateTime dateCreation;
String connectionLevel;
DateTime lastConnectionLevel;
String batteryLevel;
DateTime lastBatteryLevel;
@override
bool operator ==(Object other) => identical(this, other) || other is DeviceDetailDTO &&
other.id == id &&
other.name == name &&
other.ipAddress == ipAddress &&
other.configurationId == configurationId &&
other.configuration == configuration &&
other.connected == connected &&
other.dateCreation == dateCreation &&
other.connectionLevel == connectionLevel &&
other.lastConnectionLevel == lastConnectionLevel &&
other.batteryLevel == batteryLevel &&
other.lastBatteryLevel == lastBatteryLevel;
@override
int get hashCode =>
(id == null ? 0 : id.hashCode) +
(name == null ? 0 : name.hashCode) +
(ipAddress == null ? 0 : ipAddress.hashCode) +
(configurationId == null ? 0 : configurationId.hashCode) +
(configuration == null ? 0 : configuration.hashCode) +
(connected == null ? 0 : connected.hashCode) +
(dateCreation == null ? 0 : dateCreation.hashCode) +
(connectionLevel == null ? 0 : connectionLevel.hashCode) +
(lastConnectionLevel == null ? 0 : lastConnectionLevel.hashCode) +
(batteryLevel == null ? 0 : batteryLevel.hashCode) +
(lastBatteryLevel == null ? 0 : lastBatteryLevel.hashCode);
@override
String toString() => 'DeviceDetailDTO[id=$id, name=$name, ipAddress=$ipAddress, configurationId=$configurationId, configuration=$configuration, connected=$connected, dateCreation=$dateCreation, connectionLevel=$connectionLevel, lastConnectionLevel=$lastConnectionLevel, batteryLevel=$batteryLevel, lastBatteryLevel=$lastBatteryLevel]';
Map<String, dynamic> toJson() {
final json = <String, dynamic>{};
if (id != null) {
json[r'id'] = id;
}
if (name != null) {
json[r'name'] = name;
}
if (ipAddress != null) {
json[r'ipAddress'] = ipAddress;
}
if (configurationId != null) {
json[r'configurationId'] = configurationId;
}
if (configuration != null) {
json[r'configuration'] = configuration;
}
if (connected != null) {
json[r'connected'] = connected;
}
if (dateCreation != null) {
json[r'dateCreation'] = dateCreation.toUtc().toIso8601String();
}
if (connectionLevel != null) {
json[r'connectionLevel'] = connectionLevel;
}
if (lastConnectionLevel != null) {
json[r'lastConnectionLevel'] = lastConnectionLevel.toUtc().toIso8601String();
}
if (batteryLevel != null) {
json[r'batteryLevel'] = batteryLevel;
}
if (lastBatteryLevel != null) {
json[r'lastBatteryLevel'] = lastBatteryLevel.toUtc().toIso8601String();
}
return json;
}
/// Returns a new [DeviceDetailDTO] instance and imports its values from
/// [json] if it's non-null, null if [json] is null.
static DeviceDetailDTO fromJson(Map<String, dynamic> json) => json == null
? null
: DeviceDetailDTO(
id: json[r'id'],
name: json[r'name'],
ipAddress: json[r'ipAddress'],
configurationId: json[r'configurationId'],
configuration: json[r'configuration'],
connected: json[r'connected'],
dateCreation: json[r'dateCreation'] == null
? null
: DateTime.parse(json[r'dateCreation']),
connectionLevel: json[r'connectionLevel'],
lastConnectionLevel: json[r'lastConnectionLevel'] == null
? null
: DateTime.parse(json[r'lastConnectionLevel']),
batteryLevel: json[r'batteryLevel'],
lastBatteryLevel: json[r'lastBatteryLevel'] == null
? null
: DateTime.parse(json[r'lastBatteryLevel']),
);
static List<DeviceDetailDTO> listFromJson(List<dynamic> json, {bool emptyIsNull, bool growable,}) =>
json == null || json.isEmpty
? true == emptyIsNull ? null : <DeviceDetailDTO>[]
: json.map((v) => DeviceDetailDTO.fromJson(v)).toList(growable: true == growable);
static Map<String, DeviceDetailDTO> mapFromJson(Map<String, dynamic> json) {
final map = <String, DeviceDetailDTO>{};
if (json != null && json.isNotEmpty) {
json.forEach((String key, dynamic v) => map[key] = DeviceDetailDTO.fromJson(v));
}
return map;
}
// maps a json object with a list of DeviceDetailDTO-objects as value to a dart map
static Map<String, List<DeviceDetailDTO>> mapListFromJson(Map<String, dynamic> json, {bool emptyIsNull, bool growable,}) {
final map = <String, List<DeviceDetailDTO>>{};
if (json != null && json.isNotEmpty) {
json.forEach((String key, dynamic v) {
map[key] = DeviceDetailDTO.listFromJson(v, emptyIsNull: emptyIsNull, growable: growable);
});
}
return map;
}
}