-
Maximilian Betz authoredMaximilian Betz authored
datamodel.dart 2.95 KiB
import 'package:shared_preferences/shared_preferences.dart';
class Device{
int id;
String urn;
Device(this.id, this.urn);
factory Device.fromJson(Map<String, dynamic> parsedJson){
return Device( parsedJson['id'] as int,
parsedJson['urn'] as String);
}
@override
String toString(){
return '{ ${this.id}, ${this.urn} }';
}
}
class Event{
int id;
String urn;
String label;
String type;
String description;
String status;
Event(
this.id,
this.urn,
this.label,
this.type,
this.description,
this.status
);
factory Event.fromJson(Map<String, dynamic> parsedJson){
return Event( parsedJson['id'] as int,
parsedJson['urn'] as String,
parsedJson['label'] as String,
parsedJson['type'] as String,
parsedJson['description'] as String,
parsedJson['status'] as String );
}
@override
String toString(){
return '{ ${this.id}, ${this.urn}, ${this.label}, ${this.type}, ${this.description}, ${this.status} }';
}
}
class EventType{
int id;
String name;
EventType(
this.id,
this.name
);
factory EventType.fromJson(Map<String, dynamic> parsedJson){
return EventType(parsedJson['id'] as int, parsedJson['name'] as String);
}
}
abstract class DeviceStoreBase {
List<Device> store = [];
int getDeviceIdFromUrn(String urn) {