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

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

Map<String, dynamic> userResponseEntityToJson(UserResponseEntity 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;
}

userResponseDataFromJson(UserResponseData data, Map<String, dynamic> json) {
	if (json['id'] != null) {
		data.id = json['id'] is String
				? int.tryParse(json['id'])
				: json['id'].toInt();
	}
	if (json['accId'] != null) {
		data.accId = json['accId'] is String
				? int.tryParse(json['accId'])
				: json['accId'].toInt();
	}
	if (json['name'] != null) {
		data.name = json['name'].toString();
	}
	if (json['phone'] != null) {
		data.phone = json['phone'].toString();
	}
	if (json['password'] != null) {
		data.password = json['password'];
	}
	if (json['enable'] != null) {
		data.enable = json['enable'] is String
				? int.tryParse(json['enable'])
				: json['enable'].toInt();
	}
	if (json['isDelete'] != null) {
		data.isDelete = json['isDelete'] is String
				? int.tryParse(json['isDelete'])
				: json['isDelete'].toInt();
	}
	if (json['orgType'] != null) {
		data.orgType = json['orgType'] is String
				? int.tryParse(json['orgType'])
				: json['orgType'].toInt();
	}
	if (json['orgName'] != null) {
		data.orgName = json['orgName'].toString();
	}
	if (json['orgId'] != null) {
		data.orgId = json['orgId'] is String
				? int.tryParse(json['orgId'])
				: json['orgId'].toInt();
	}
	if (json['userMenuList'] != null) {
		data.userMenuList = (json['userMenuList'] as List).map((v) => UserResponseDataUserMenuList().fromJson(v)).toList();
	}
	if (json['menu4AppList'] != null) {
		data.menu4AppList = (json['menu4AppList'] as List).map((v) => UserAppResponseDataUserMenuList().fromJson(v)).toList();
	}
	if (json['roleIdList'] != null) {
		data.roleIdList = json['roleIdList'];
	}
	if (json['roleList'] != null) {
		data.roleList = (json['roleList'] as List).map((v) => UserResponseDataRoleList().fromJson(v)).toList();
	}
	return data;
}

Map<String, dynamic> userResponseDataToJson(UserResponseData entity) {
	final Map<String, dynamic> data = new Map<String, dynamic>();
	data['id'] = entity.id;
	data['accId'] = entity.accId;
	data['name'] = entity.name;
	data['phone'] = entity.phone;
	data['password'] = entity.password;
	data['enable'] = entity.enable;
	data['isDelete'] = entity.isDelete;
	data['orgType'] = entity.orgType;
	data['orgName'] = entity.orgName;
	data['orgId'] = entity.orgId;
	data['userMenuList'] =  entity.userMenuList.map((v) => v.toJson()).toList();
	data['menu4AppList'] =  entity.menu4AppList.map((v) => v.toJson()).toList();
	data['roleIdList'] = entity.roleIdList;
	data['roleList'] =  entity.roleList.map((v) => v.toJson()).toList();
	return data;
}

userResponseDataUserMenuListFromJson(UserResponseDataUserMenuList data, Map<String, dynamic> json) {
	if (json['id'] != null) {
		data.id = json['id'] is String
				? int.tryParse(json['id'])
				: json['id'].toInt();
	}
	if (json['pid'] != null) {
		data.pid = json['pid'] is String
				? int.tryParse(json['pid'])
				: json['pid'].toInt();
	}
	if (json['subCount'] != null) {
		data.subCount = json['subCount'] is String
				? int.tryParse(json['subCount'])
				: json['subCount'].toInt();
	}
	if (json['type'] != null) {
		data.type = json['type'] is String
				? int.tryParse(json['type'])
				: json['type'].toInt();
	}
	if (json['title'] != null) {
		data.title = json['title'].toString();
	}
	if (json['name'] != null) {
		data.name = json['name'].toString();
	}
	if (json['component'] != null) {
		data.component = json['component'].toString();
	}
	if (json['sort'] != null) {
		data.sort = json['sort'] is String
				? int.tryParse(json['sort'])
				: json['sort'].toInt();
	}
	if (json['icon'] != null) {
		data.icon = json['icon'].toString();
	}
	if (json['iconActive'] != null) {
		data.iconActive = json['iconActive'].toString();
	}
	if (json['path'] != null) {
		data.path = json['path'].toString();
	}
	if (json['isEl'] != null) {
		data.isEl = json['isEl'];
	}
	if (json['isCache'] != null) {
		data.isCache = json['isCache'];
	}
	if (json['isHidden'] != null) {
		data.isHidden = json['isHidden'];
	}
	if (json['isDelete'] != null) {
		data.isDelete = json['isDelete'];
	}
	if (json['permission'] != null) {
		data.permission = json['permission'].toString();
	}
	if (json['creator'] != null) {
		data.creator = json['creator'].toString();
	}
	if (json['createTime'] != null) {
		data.createTime = json['createTime'].toString();
	}
	if (json['subMenu'] != null) {
		data.subMenu = json['subMenu'];
	}
	if (json['pname'] != null) {
		data.pname = json['pname'];
	}
	return data;
}

userAppResponseDataUserMenuListFromJson(UserAppResponseDataUserMenuList data, Map<String, dynamic> json) {
	if (json['id'] != null) {
		data.id = json['id'] is String
				? int.tryParse(json['id'])
				: json['id'].toInt();
	}
	if (json['pid'] != null) {
		data.pid = json['pid'] is String
				? int.tryParse(json['pid'])
				: json['pid'].toInt();
	}
	if (json['subCount'] != null) {
		data.subCount = json['subCount'] is String
				? int.tryParse(json['subCount'])
				: json['subCount'].toInt();
	}
	if (json['type'] != null) {
		data.type = json['type'] is String
				? int.tryParse(json['type'])
				: json['type'].toInt();
	}
	if (json['title'] != null) {
		data.title = json['title'].toString();
	}
	if (json['name'] != null) {
		data.name = json['name'].toString();
	}
	if (json['component'] != null) {
		data.component = json['component'].toString();
	}
	if (json['sort'] != null) {
		data.sort = json['sort'] is String
				? int.tryParse(json['sort'])
				: json['sort'].toInt();
	}
	if (json['icon'] != null) {
		data.icon = json['icon'].toString();
	}
	if (json['iconActive'] != null) {
		data.iconActive = json['iconActive'].toString();
	}
	if (json['path'] != null) {
		data.path = json['path'].toString();
	}
	if (json['isEl'] != null) {
		data.isEl = json['isEl'];
	}
	if (json['isCache'] != null) {
		data.isCache = json['isCache'];
	}
	if (json['isHidden'] != null) {
		data.isHidden = json['isHidden'];
	}
	if (json['isDelete'] != null) {
		data.isDelete = json['isDelete'];
	}
	if (json['permission'] != null) {
		data.permission = json['permission'].toString();
	}
	if (json['creator'] != null) {
		data.creator = json['creator'].toString();
	}
	if (json['createTime'] != null) {
		data.createTime = json['createTime'].toString();
	}
	if (json['subMenu'] != null) {
		data.subMenu = json['subMenu'];
	}
	if (json['pname'] != null) {
		data.pname = json['pname'];
	}
	return data;
}

Map<String, dynamic> userResponseDataUserMenuListToJson(UserResponseDataUserMenuList entity) {
	final Map<String, dynamic> data = new Map<String, dynamic>();
	data['id'] = entity.id;
	data['pid'] = entity.pid;
	data['subCount'] = entity.subCount;
	data['type'] = entity.type;
	data['title'] = entity.title;
	data['name'] = entity.name;
	data['component'] = entity.component;
	data['sort'] = entity.sort;
	data['icon'] = entity.icon;
	data['iconActive'] = entity.iconActive;
	data['path'] = entity.path;
	data['isEl'] = entity.isEl;
	data['isCache'] = entity.isCache;
	data['isHidden'] = entity.isHidden;
	data['isDelete'] = entity.isDelete;
	data['permission'] = entity.permission;
	data['creator'] = entity.creator;
	data['createTime'] = entity.createTime;
	data['subMenu'] = entity.subMenu;
	data['pname'] = entity.pname;
	return data;
}

Map<String, dynamic> userAppResponseDataUserMenuListToJson(UserAppResponseDataUserMenuList entity) {
	final Map<String, dynamic> data = new Map<String, dynamic>();
	data['id'] = entity.id;
	data['pid'] = entity.pid;
	data['subCount'] = entity.subCount;
	data['type'] = entity.type;
	data['title'] = entity.title;
	data['name'] = entity.name;
	data['component'] = entity.component;
	data['sort'] = entity.sort;
	data['icon'] = entity.icon;
	data['iconActive'] = entity.iconActive;
	data['path'] = entity.path;
	data['isEl'] = entity.isEl;
	data['isCache'] = entity.isCache;
	data['isHidden'] = entity.isHidden;
	data['isDelete'] = entity.isDelete;
	data['permission'] = entity.permission;
	data['creator'] = entity.creator;
	data['createTime'] = entity.createTime;
	data['subMenu'] = entity.subMenu;
	data['pname'] = entity.pname;
	return data;
}

userResponseDataRoleListFromJson(UserResponseDataRoleList 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['type'] != null) {
		data.type = json['type'];
	}
	if (json['level'] != null) {
		data.level = json['level'] is String
				? int.tryParse(json['level'])
				: json['level'].toInt();
	}
	if (json['description'] != null) {
		data.description = json['description'].toString();
	}
	if (json['dataScope'] != null) {
		data.dataScope = json['dataScope'];
	}
	if (json['enable'] != null) {
		data.enable = json['enable'] is String
				? int.tryParse(json['enable'])
				: json['enable'].toInt();
	}
	if (json['creator'] != null) {
		data.creator = json['creator'].toString();
	}
	if (json['createTime'] != null) {
		data.createTime = json['createTime'].toString();
	}
	if (json['menuList'] != null) {
		data.menuList = json['menuList'];
	}
	return data;
}

Map<String, dynamic> userResponseDataRoleListToJson(UserResponseDataRoleList entity) {
	final Map<String, dynamic> data = new Map<String, dynamic>();
	data['id'] = entity.id;
	data['name'] = entity.name;
	data['type'] = entity.type;
	data['level'] = entity.level;
	data['description'] = entity.description;
	data['dataScope'] = entity.dataScope;
	data['enable'] = entity.enable;
	data['creator'] = entity.creator;
	data['createTime'] = entity.createTime;
	data['menuList'] = entity.menuList;
	return data;
}