2024-05-18 09:37:50 +08:00

108 lines
3.6 KiB
Dart
Executable File

import 'package:star_lock/main/lockDetail/messageWarn/msgNotification/openDoorNotify/openDoorNotify_entity.dart';
class MsgNotificationEntity {
int? errorCode;
String? description;
String? errorMsg;
MsgNoticeData? data;
MsgNotificationEntity(
{this.errorCode, this.description, this.errorMsg, this.data});
MsgNotificationEntity.fromJson(Map<String, dynamic> json) {
errorCode = json['errorCode'];
description = json['description'];
errorMsg = json['errorMsg'];
data = json['data'] != null ? MsgNoticeData.fromJson(json['data']) : null;
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = <String, dynamic>{};
data['errorCode'] = errorCode;
data['description'] = description;
data['errorMsg'] = errorMsg;
if (this.data != null) {
data['data'] = this.data!.toJson();
}
return data;
}
}
class MsgNoticeData {
int? dayNotOpenDoorState;
int? dayNotOpenDoorValue;
List<NoticeWay>? dayNotOpenDoorNoticeWayList;
int? doorNotCloseState;
int? tamperAlarmState;
int? lowElecNoticeState;
List<NoticeWay>? lowElecNoticeWayList;
List? coercionOpenDoorNoticeList;
int? doorbellNoticeState;
int? someoneAtDoorNoticeState;
MsgNoticeData(
{this.dayNotOpenDoorState,
this.dayNotOpenDoorValue,
this.dayNotOpenDoorNoticeWayList,
this.doorNotCloseState,
this.tamperAlarmState,
this.lowElecNoticeState,
this.lowElecNoticeWayList,
this.coercionOpenDoorNoticeList,
this.doorbellNoticeState,
this.someoneAtDoorNoticeState});
MsgNoticeData.fromJson(Map<String, dynamic> json) {
dayNotOpenDoorState = json['dayNotOpenDoorState'];
dayNotOpenDoorValue = json['dayNotOpenDoorValue'];
if (json['dayNotOpenDoorNoticeWayList'] != null) {
dayNotOpenDoorNoticeWayList = <NoticeWay>[];
json['dayNotOpenDoorNoticeWayList'].forEach((v) {
dayNotOpenDoorNoticeWayList!.add(NoticeWay.fromJson(v));
});
}
doorNotCloseState = json['doorNotCloseState'];
tamperAlarmState = json['tamperAlarmState'];
lowElecNoticeState = json['lowElecNoticeState'];
if (json['lowElecNoticeWayList'] != null) {
lowElecNoticeWayList = <NoticeWay>[];
json['lowElecNoticeWayList'].forEach((v) {
lowElecNoticeWayList!.add(NoticeWay.fromJson(v));
});
}
if (json['coercionOpenDoorNoticeList'] != null) {
coercionOpenDoorNoticeList = [];
json['coercionOpenDoorNoticeList'].forEach((v) {
coercionOpenDoorNoticeList!.add(v);
});
}
doorbellNoticeState = json['doorbellNoticeState'];
someoneAtDoorNoticeState = json['someoneAtDoorNoticeState'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = <String, dynamic>{};
data['dayNotOpenDoorState'] = dayNotOpenDoorState;
data['dayNotOpenDoorValue'] = dayNotOpenDoorValue;
if (dayNotOpenDoorNoticeWayList != null) {
data['dayNotOpenDoorNoticeWayList'] =
dayNotOpenDoorNoticeWayList!.map((v) => v.toJson()).toList();
}
data['doorNotCloseState'] = doorNotCloseState;
data['tamperAlarmState'] = tamperAlarmState;
data['lowElecNoticeState'] = lowElecNoticeState;
if (lowElecNoticeWayList != null) {
data['lowElecNoticeWayList'] =
lowElecNoticeWayList!.map((v) => v.toJson()).toList();
}
if (coercionOpenDoorNoticeList != null) {
data['coercionOpenDoorNoticeList'] =
coercionOpenDoorNoticeList!.map((v) => v.toJson()).toList();
}
data['doorbellNoticeState'] = doorbellNoticeState;
data['someoneAtDoorNoticeState'] = someoneAtDoorNoticeState;
return data;
}
}