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

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

Map<String, dynamic> maintItemsListResponseEntityToJson(MaintItemsListResponseEntity 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;
}

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

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

maintItemsListResponseDataQueryFromJson(MaintItemsListResponseDataQuery data, Map<String, dynamic> json) {
	if (json['index'] != null) {
		data.index = json['index'] is String
				? int.tryParse(json['index'])
				: json['index'].toInt();
	}
	if (json['size'] != null) {
		data.size = json['size'] is String
				? int.tryParse(json['size'])
				: json['size'].toInt();
	}
	if (json['total'] != null) {
		data.total = json['total'];
	}
	if (json['id'] != null) {
		data.id = json['id'];
	}
	if (json['name'] != null) {
		data.name = json['name'];
	}
	if (json['num'] != null) {
		data.num = json['num'];
	}
	if (json['level'] != null) {
		data.level = json['level'];
	}
	if (json['status'] != null) {
		data.status = json['status'];
	}
	if (json['requirements'] != null) {
		data.requirements = json['requirements'];
	}
	if (json['remarks'] != null) {
		data.remarks = json['remarks'];
	}
	if (json['offset'] != null) {
		data.offset = json['offset'];
	}
	if (json['limit'] != null) {
		data.limit = json['limit'];
	}
	if (json['paramError'] != null) {
		data.paramError = json['paramError'];
	}
	return data;
}

Map<String, dynamic> maintItemsListResponseDataQueryToJson(MaintItemsListResponseDataQuery entity) {
	final Map<String, dynamic> data = new Map<String, dynamic>();
	data['index'] = entity.index;
	data['size'] = entity.size;
	data['total'] = entity.total;
	data['id'] = entity.id;
	data['name'] = entity.name;
	data['num'] = entity.num;
	data['level'] = entity.level;
	data['status'] = entity.status;
	data['requirements'] = entity.requirements;
	data['remarks'] = entity.remarks;
	data['offset'] = entity.offset;
	data['limit'] = entity.limit;
	data['paramError'] = entity.paramError;
	return data;
}

maintItemsListResponseDataListFromJson(MaintItemsListResponseDataList data, Map<String, dynamic> json) {
	if (json['id'] != null) {
		data.id = json['id'] is String
				? int.tryParse(json['id'])
				: json['id'].toInt();
	}
	if (json['num'] != null) {
		data.num = json['num'].toString();
	}
	if (json['name'] != null) {
		data.name = json['name'].toString();
	}
	if (json['level'] != null) {
		data.level = json['level'] is String
				? int.tryParse(json['level'])
				: json['level'].toInt();
	}
	if (json['status'] != null) {
		data.status = json['status'] is String
				? int.tryParse(json['status'])
				: json['status'].toInt();
	}
	if (json['requirements'] != null) {
		data.requirements = json['requirements'].toString();
	}
	if (json['remarks'] != null) {
		data.remarks = json['remarks'].toString();
	}
	return data;
}

Map<String, dynamic> maintItemsListResponseDataListToJson(MaintItemsListResponseDataList entity) {
	final Map<String, dynamic> data = new Map<String, dynamic>();
	data['id'] = entity.id;
	data['num'] = entity.num;
	data['name'] = entity.name;
	data['level'] = entity.level;
	data['status'] = entity.status;
	data['requirements'] = entity.requirements;
	data['remarks'] = entity.remarks;
	return data;
}