import 'package:deus_app/model/equipment_info_entity.dart';

equipmentInfoEntityFromJson(EquipmentInfoEntity data, Map<String, dynamic> json) {
	if (json['code'] != null) {
		data.code = json['code'] is String
				? int.tryParse(json['code'])
				: json['code'].toInt();
	}
	if (json['data'] != null) {
		data.data = EquipmentInfoData().fromJson(json['data']);
	}
	if (json['msg'] != null) {
		data.msg = json['msg'].toString();
	}
	return data;
}

Map<String, dynamic> equipmentInfoEntityToJson(EquipmentInfoEntity entity) {
	final Map<String, dynamic> data = new Map<String, dynamic>();
	data['code'] = entity.code;
	data['data'] = entity.data.toJson();
	data['msg'] = entity.msg;
	return data;
}

equipmentInfoDataFromJson(EquipmentInfoData data, Map<String, dynamic> json) {
	if (json['id'] != null) {
		data.id = json['id'] is String
				? int.tryParse(json['id'])
				: json['id'].toInt();
	}
	if (json['name'] != null) {
		data.name = json['name'].toString();
	}
	if (json['showName'] != null) {
		data.showName = json['showName'].toString();
	}
	if (json['deviceKey'] != null) {
		data.deviceKey = json['deviceKey'].toString();
	}
	if (json['authType'] != null) {
		data.authType = json['authType'] is String
				? int.tryParse(json['authType'])
				: json['authType'].toInt();
	}
	if (json['isEnable'] != null) {
		data.isEnable = json['isEnable'] is String
				? int.tryParse(json['isEnable'])
				: json['isEnable'].toInt();
	}
	if (json['isActive'] != null) {
		data.isActive = json['isActive'] is String
				? int.tryParse(json['isActive'])
				: json['isActive'].toInt();
	}
	if (json['deviceSecret'] != null) {
		data.deviceSecret = json['deviceSecret'].toString();
	}
	if (json['deviceId'] != null) {
		data.deviceId = json['deviceId'].toString();
	}
	if (json['productName'] != null) {
		data.productName = json['productName'].toString();
	}
	if (json['productKey'] != null) {
		data.productKey = json['productKey'].toString();
	}
	if (json['productId'] != null) {
		data.productId = json['productId'] is String
				? int.tryParse(json['productId'])
				: json['productId'].toInt();
	}
	if (json['status'] != null) {
		data.status = json['status'] is String
				? int.tryParse(json['status'])
				: json['status'].toInt();
	}
	if (json['nodeType'] != null) {
		data.nodeType = json['nodeType'] is String
				? int.tryParse(json['nodeType'])
				: json['nodeType'].toInt();
	}
	if (json['connectionProtocol'] != null) {
		data.connectionProtocol = json['connectionProtocol'] is String
				? int.tryParse(json['connectionProtocol'])
				: json['connectionProtocol'].toInt();
	}
	if (json['ip'] != null) {
		data.ip = json['ip'].toString();
	}
	if (json['lastUpdateOn'] != null) {
		data.lastUpdateOn = json['lastUpdateOn'];
	}
	if (json['activationOn'] != null) {
		data.activationOn = json['activationOn'].toString();
	}
	if (json['positionId'] != null) {
		data.positionId = json['positionId'];
	}
	if (json['number'] != null) {
		data.number = json['number'];
	}
	if (json['speedA'] != null) {
		data.speedA = json['speedA'].toString();
	}
	if (json['speedB'] != null) {
		data.speedB = json['speedB'].toString();
	}
	if (json['finenessA'] != null) {
		data.finenessA = json['finenessA'].toString();
	}
	if (json['finenessB'] != null) {
		data.finenessB = json['finenessB'].toString();
	}
	if (json['holeCountA'] != null) {
		data.holeCountA = json['holeCountA'].toString();
	}
	if (json['holeCountB'] != null) {
		data.holeCountB = json['holeCountB'].toString();
	}
	if (json['activePeriod'] != null) {
		data.activePeriod = json['activePeriod'];
	}
	if (json['createdOn'] != null) {
		data.createdOn = json['createdOn'].toString();
	}
	if (json['lastOnlineOn'] != null) {
		data.lastOnlineOn = json['lastOnlineOn'].toString();
	}
	if (json['iotId'] != null) {
		data.iotId = json['iotId'].toString();
	}
	if (json['description'] != null) {
		data.description = json['description'];
	}
	if (json['customerId'] != null) {
		data.customerId = json['customerId'].toString();
	}
	if (json['channelId'] != null) {
		data.channelId = json['channelId'].toString();
	}
	if (json['imei'] != null) {
		data.imei = json['imei'];
	}
	return data;
}

Map<String, dynamic> equipmentInfoDataToJson(EquipmentInfoData entity) {
	final Map<String, dynamic> data = new Map<String, dynamic>();
	data['id'] = entity.id;
	data['name'] = entity.name;
	data['showName'] = entity.showName;
	data['deviceKey'] = entity.deviceKey;
	data['authType'] = entity.authType;
	data['isEnable'] = entity.isEnable;
	data['isActive'] = entity.isActive;
	data['deviceSecret'] = entity.deviceSecret;
	data['deviceId'] = entity.deviceId;
	data['productName'] = entity.productName;
	data['productKey'] = entity.productKey;
	data['productId'] = entity.productId;
	data['status'] = entity.status;
	data['nodeType'] = entity.nodeType;
	data['connectionProtocol'] = entity.connectionProtocol;
	data['ip'] = entity.ip;
	data['lastUpdateOn'] = entity.lastUpdateOn;
	data['activationOn'] = entity.activationOn;
	data['positionId'] = entity.positionId;
	data['number'] = entity.number;
	data['speedA'] = entity.speedA;
	data['speedB'] = entity.speedB;
	data['finenessA'] = entity.finenessA;
	data['finenessB'] = entity.finenessB;
	data['holeCountA'] = entity.holeCountA;
	data['holeCountB'] = entity.holeCountB;
	data['activePeriod'] = entity.activePeriod;
	data['createdOn'] = entity.createdOn;
	data['lastOnlineOn'] = entity.lastOnlineOn;
	data['iotId'] = entity.iotId;
	data['description'] = entity.description;
	data['customerId'] = entity.customerId;
	data['channelId'] = entity.channelId;
	data['imei'] = entity.imei;
	return data;
}