mirror of
https://bitbucket.org/myhomie/mycorerepository.git
synced 2025-12-06 09:41:19 +00:00
150 lines
4.3 KiB
Dart
150 lines
4.3 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 Automation {
|
|
/// Returns a new [Automation] instance.
|
|
Automation({
|
|
this.id,
|
|
this.userId,
|
|
this.name,
|
|
this.createdDate,
|
|
this.updatedDate,
|
|
this.triggers,
|
|
this.conditions,
|
|
this.actions,
|
|
this.devicesIds,
|
|
});
|
|
|
|
String id;
|
|
|
|
String userId;
|
|
|
|
String name;
|
|
|
|
DateTime createdDate;
|
|
|
|
DateTime updatedDate;
|
|
|
|
List<Trigger> triggers;
|
|
|
|
List<Condition> conditions;
|
|
|
|
List<Action> actions;
|
|
|
|
List<String> devicesIds;
|
|
|
|
@override
|
|
bool operator ==(Object other) => identical(this, other) || other is Automation &&
|
|
other.id == id &&
|
|
other.userId == userId &&
|
|
other.name == name &&
|
|
other.createdDate == createdDate &&
|
|
other.updatedDate == updatedDate &&
|
|
other.triggers == triggers &&
|
|
other.conditions == conditions &&
|
|
other.actions == actions &&
|
|
other.devicesIds == devicesIds;
|
|
|
|
@override
|
|
int get hashCode =>
|
|
(id == null ? 0 : id.hashCode) +
|
|
(userId == null ? 0 : userId.hashCode) +
|
|
(name == null ? 0 : name.hashCode) +
|
|
(createdDate == null ? 0 : createdDate.hashCode) +
|
|
(updatedDate == null ? 0 : updatedDate.hashCode) +
|
|
(triggers == null ? 0 : triggers.hashCode) +
|
|
(conditions == null ? 0 : conditions.hashCode) +
|
|
(actions == null ? 0 : actions.hashCode) +
|
|
(devicesIds == null ? 0 : devicesIds.hashCode);
|
|
|
|
@override
|
|
String toString() => 'Automation[id=$id, userId=$userId, name=$name, createdDate=$createdDate, updatedDate=$updatedDate, triggers=$triggers, conditions=$conditions, actions=$actions, devicesIds=$devicesIds]';
|
|
|
|
Map<String, dynamic> toJson() {
|
|
final json = <String, dynamic>{};
|
|
if (id != null) {
|
|
json[r'id'] = id;
|
|
}
|
|
if (userId != null) {
|
|
json[r'userId'] = userId;
|
|
}
|
|
if (name != null) {
|
|
json[r'name'] = name;
|
|
}
|
|
if (createdDate != null) {
|
|
json[r'createdDate'] = createdDate.toUtc().toIso8601String();
|
|
}
|
|
if (updatedDate != null) {
|
|
json[r'updatedDate'] = updatedDate.toUtc().toIso8601String();
|
|
}
|
|
if (triggers != null) {
|
|
json[r'triggers'] = triggers;
|
|
}
|
|
if (conditions != null) {
|
|
json[r'conditions'] = conditions;
|
|
}
|
|
if (actions != null) {
|
|
json[r'actions'] = actions;
|
|
}
|
|
if (devicesIds != null) {
|
|
json[r'devicesIds'] = devicesIds;
|
|
}
|
|
return json;
|
|
}
|
|
|
|
/// Returns a new [Automation] instance and imports its values from
|
|
/// [json] if it's non-null, null if [json] is null.
|
|
static Automation fromJson(Map<String, dynamic> json) => json == null
|
|
? null
|
|
: Automation(
|
|
id: json[r'id'],
|
|
userId: json[r'userId'],
|
|
name: json[r'name'],
|
|
createdDate: json[r'createdDate'] == null
|
|
? null
|
|
: DateTime.parse(json[r'createdDate']),
|
|
updatedDate: json[r'updatedDate'] == null
|
|
? null
|
|
: DateTime.parse(json[r'updatedDate']),
|
|
triggers: Trigger.listFromJson(json[r'triggers']),
|
|
conditions: Condition.listFromJson(json[r'conditions']),
|
|
actions: Action.listFromJson(json[r'actions']),
|
|
devicesIds: json[r'devicesIds'] == null
|
|
? null
|
|
: (json[r'devicesIds'] as List).cast<String>(),
|
|
);
|
|
|
|
static List<Automation> listFromJson(List<dynamic> json, {bool emptyIsNull, bool growable,}) =>
|
|
json == null || json.isEmpty
|
|
? true == emptyIsNull ? null : <Automation>[]
|
|
: json.map((v) => Automation.fromJson(v)).toList(growable: true == growable);
|
|
|
|
static Map<String, Automation> mapFromJson(Map<String, dynamic> json) {
|
|
final map = <String, Automation>{};
|
|
if (json != null && json.isNotEmpty) {
|
|
json.forEach((String key, dynamic v) => map[key] = Automation.fromJson(v));
|
|
}
|
|
return map;
|
|
}
|
|
|
|
// maps a json object with a list of Automation-objects as value to a dart map
|
|
static Map<String, List<Automation>> mapListFromJson(Map<String, dynamic> json, {bool emptyIsNull, bool growable,}) {
|
|
final map = <String, List<Automation>>{};
|
|
if (json != null && json.isNotEmpty) {
|
|
json.forEach((String key, dynamic v) {
|
|
map[key] = Automation.listFromJson(v, emptyIsNull: emptyIsNull, growable: growable);
|
|
});
|
|
}
|
|
return map;
|
|
}
|
|
}
|
|
|