import request from "../../request.js"

export default {
	// 获取设备统计数量
	getDeviceCount(data){
		return new Promise((resolve, reject) => {
			request.TokenRequest({
				url: '/iot/admin/device/statistics/count',
				method: 'GET',
			},data)
			.then((res) =>{
				resolve(res);
			}).catch(err =>{
				reject(err);
			})
		})
	},
	
	// 获取产品列表
	getProductList(data){
		return new Promise((resolve, reject) => {
			request.TokenRequest({
				url: '/iot/admin/product/list',
				method: 'GET',
			},data)
			.then((res) =>{
				resolve(res);
			}).catch(err =>{
				reject(err);
			})
		})
	},
	
	// 获取设备列表
	getDeviceList(data){
		return new Promise((resolve, reject) => {
			request.TokenRequest({
				url: '/iot/admin/device/list',
				method: 'POST',
			},data)
			.then((res) =>{
				resolve(res);
			}).catch(err =>{
				reject(err);
			})
		})
	},
	
	// 获取指定设备信息
	getDeviceInfo(data){
		return new Promise((resolve, reject) => {
			request.TokenRequest({
				url: '/iot/admin/device/view',
				method: 'GET',
			},data)
			.then((res) =>{
				resolve(res);
			}).catch(err =>{
				reject(err);
			})
		})
	},
	
	// 设备属性下发
	downDeviceProp(data){
		return new Promise((resolve, reject) => {
			request.TokenRequest({
				url: '/iot/admin/device/data/prop/down',
				method: 'POST',
			},data)
			.then((res) =>{
				resolve(res);
			}).catch(err =>{
				reject(err);
			})
		})
	},
	
	// 属性数据列表
	getDeviceDataList(data){
		return new Promise((resolve, reject) => {
			request.TokenRequest({
				url: '/iot/admin/device/ts/prop/list',
				method: 'GET',
			},data)
			.then((res) =>{
				resolve(res);
			}).catch(err =>{
				reject(err);
			})
		})
	},
	
	// 设备属性下发
	downDeviceAbility(data){
		return new Promise((resolve, reject) => {
			request.TokenRequest({
				url: '/iot/admin/device/data/down',
				method: 'POST',
			},data)
			.then((res) =>{
				resolve(res);
			}).catch(err =>{
				reject(err);
			})
		})
	},
	
	// 告警
	// 告警记录数量统计
	getAlarmReacordCount(data){
		return new Promise((resolve, reject) => {
			request.TokenRequest({
				url: '/iot/admin/alarm/record/count',
				method: 'GET',
			},data)
			.then((res) =>{
				resolve(res);
			}).catch(err =>{
				reject(err);
			})
		})
	},
	
	// 告警记录列表
	getAlarmReacordList(data){
		return new Promise((resolve, reject) => {
			request.TokenRequest({
				url: '/iot/admin/alarm/record/list',
				method: 'POST',
			},data)
			.then((res) =>{
				resolve(res);
			}).catch(err =>{
				reject(err);
			})
		})
	},
	
	// 告警级别列表
	getAlarmLevelList(data){
		return new Promise((resolve, reject) => {
			request.TokenRequest({
				url: '/iot/admin/alarm/level/list',
				method: 'GET',
			},data)
			.then((res) =>{
				resolve(res);
			}).catch(err =>{
				reject(err);
			})
		})
	},
	
	// 概览页统计(图表)
	getAlarmRecordStat(data){
		return new Promise((resolve, reject) => {
			request.TokenRequest({
				url: '/iot/admin/alarm/record/stat',
				method: 'GET',
			},data)
			.then((res) =>{
				resolve(res);
			}).catch(err =>{
				reject(err);
			})
		})
	},
	
	// 告警记录审核
	applyAlarmRecord(data){
		return new Promise((resolve, reject) => {
			request.TokenRequest({
				url: '/iot/admin/alarm/record/apply',
				method: 'POST',
			},data)
			.then((res) =>{
				resolve(res);
			}).catch(err =>{
				reject(err);
			})
		})
	},
}