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

repairQueryDeviceResponseEntityFromJson(RepairQueryDeviceResponseEntity 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 = RepairQueryDeviceResponseData().fromJson(json['data']);
	}
	if (json['msg'] != null) {
		data.msg = json['msg'].toString();
	}
	return data;
}

Map<String, dynamic> repairQueryDeviceResponseEntityToJson(RepairQueryDeviceResponseEntity 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;
}

repairQueryDeviceResponseDataFromJson(RepairQueryDeviceResponseData data, Map<String, dynamic> json) {
	if (json['index'] != null) {
		data.index = json['index'] is String
				? int.tryParse(json['index'])
				: json['index'].toInt();
	}
	if (json['list'] != null) {
		data.xList = (json['list'] as List).map((v) => RepairQueryDeviceResponseDataList().fromJson(v)).toList();
	}
	if (json['query'] != null) {
		data.query = RepairQueryDeviceResponseDataQuery().fromJson(json['query']);
	}
	if (json['size'] != null) {
		data.size = json['size'] is String
				? int.tryParse(json['size'])
				: json['size'].toInt();
	}
	if (json['sort'] != null) {
		data.sort = json['sort'] is String
				? int.tryParse(json['sort'])
				: json['sort'].toInt();
	}
	if (json['sortBy'] != null) {
		data.sortBy = json['sortBy'].toString();
	}
	if (json['total'] != null) {
		data.total = json['total'] is String
				? int.tryParse(json['total'])
				: json['total'].toInt();
	}
	return data;
}

Map<String, dynamic> repairQueryDeviceResponseDataToJson(RepairQueryDeviceResponseData entity) {
	final Map<String, dynamic> data = new Map<String, dynamic>();
	data['index'] = entity.index;
	data['list'] =  entity.xList.map((v) => v.toJson()).toList();
	data['query'] = entity.query.toJson();
	data['size'] = entity.size;
	data['sort'] = entity.sort;
	data['sortBy'] = entity.sortBy;
	data['total'] = entity.total;
	return data;
}

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

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

repairQueryDeviceResponseDataQueryFromJson(RepairQueryDeviceResponseDataQuery data, Map<String, dynamic> json) {
	if (json['search'] != null) {
		data.search = json['search'].toString();
	}
	return data;
}

Map<String, dynamic> repairQueryDeviceResponseDataQueryToJson(RepairQueryDeviceResponseDataQuery entity) {
	final Map<String, dynamic> data = new Map<String, dynamic>();
	data['search'] = entity.search;
	return data;
}