myhomie_app/mycore_api/lib/model/condition.dart
2021-03-30 19:13:44 +02:00

117 lines
3.2 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 Condition {
/// Returns a new [Condition] instance.
Condition({
this.deviceId,
this.state,
this.startTime,
this.endTime,
this.type,
this.value,
});
String deviceId;
AutomationState state;
String startTime;
String endTime;
ConditionType type;
ConditionValue value;
@override
bool operator ==(Object other) => identical(this, other) || other is Condition &&
other.deviceId == deviceId &&
other.state == state &&
other.startTime == startTime &&
other.endTime == endTime &&
other.type == type &&
other.value == value;
@override
int get hashCode =>
(deviceId == null ? 0 : deviceId.hashCode) +
(state == null ? 0 : state.hashCode) +
(startTime == null ? 0 : startTime.hashCode) +
(endTime == null ? 0 : endTime.hashCode) +
(type == null ? 0 : type.hashCode) +
(value == null ? 0 : value.hashCode);
@override
String toString() => 'Condition[deviceId=$deviceId, state=$state, startTime=$startTime, endTime=$endTime, type=$type, value=$value]';
Map<String, dynamic> toJson() {
final json = <String, dynamic>{};
if (deviceId != null) {
json[r'deviceId'] = deviceId;
}
if (state != null) {
json[r'state'] = state;
}
if (startTime != null) {
json[r'startTime'] = startTime;
}
if (endTime != null) {
json[r'endTime'] = endTime;
}
if (type != null) {
json[r'type'] = type;
}
if (value != null) {
json[r'value'] = value;
}
return json;
}
/// Returns a new [Condition] instance and imports its values from
/// [json] if it's non-null, null if [json] is null.
static Condition fromJson(Map<String, dynamic> json) => json == null
? null
: Condition(
deviceId: json[r'deviceId'],
state: AutomationState.fromJson(json[r'state']),
startTime: json[r'startTime'],
endTime: json[r'endTime'],
type: ConditionType.fromJson(json[r'type']),
value: ConditionValue.fromJson(json[r'value']),
);
static List<Condition> listFromJson(List<dynamic> json, {bool emptyIsNull, bool growable,}) =>
json == null || json.isEmpty
? true == emptyIsNull ? null : <Condition>[]
: json.map((v) => Condition.fromJson(v)).toList(growable: true == growable);
static Map<String, Condition> mapFromJson(Map<String, dynamic> json) {
final map = <String, Condition>{};
if (json != null && json.isNotEmpty) {
json.forEach((String key, dynamic v) => map[key] = Condition.fromJson(v));
}
return map;
}
// maps a json object with a list of Condition-objects as value to a dart map
static Map<String, List<Condition>> mapListFromJson(Map<String, dynamic> json, {bool emptyIsNull, bool growable,}) {
final map = <String, List<Condition>>{};
if (json != null && json.isNotEmpty) {
json.forEach((String key, dynamic v) {
map[key] = Condition.listFromJson(v, emptyIsNull: emptyIsNull, growable: growable);
});
}
return map;
}
}