'use strict';

import { ApiTable, basicAction } from '$utils'

export function getProjectPoms () {       //获取已绑定项目
   return dispatch => basicAction({
      type: 'get',
      dispatch: dispatch,
      actionType: 'GET_PROJECT_POMS',
      url: `${ApiTable.getProjectPoms}`,
      msg: { error: '获取已绑定项目失败' },
      reducer: { name: '' }
   });
}


export function getAlarmLnspection (query) {   //查询应用巡检信息
   return dispatch => basicAction({
      type: 'get',
      dispatch: dispatch,
      query,
      actionType: 'GET_ALARM_LNICSPECTION',
      url: `${ApiTable.getAlarmLnspection}`,
      msg: { error: '查询应用巡检信息失败' },
      reducer: { name: '' }
   });
}


export function putAlarmApplicationNoted (data) {   //预览状态
   return dispatch => basicAction({
      type: 'put',
      dispatch: dispatch,
      data,
      actionType: 'PUT-AIARM-APPLICATIO-NNOTED',
      url: `${ApiTable.putAlarmApplicationNoted}`,
      msg: { error: '预览失败' },
      reducer: { name: '' }
   });
}

export function getAlarmLnspectionApi (query) {   //查询应用接口/元素错误信息
   return dispatch => basicAction({
      type: 'get',
      dispatch: dispatch,
      query,
      actionType: 'GET_ALARM_LNICSPECTION-API',
      url: `${ApiTable.getAlarmLnspectionApi}`,
      msg: { error: '查询应用接口/元素错误信息失败' },
      reducer: { name: '' }
   });
}

export function postApiConfirm (data) {   //确认应用接口/元素错误信息
   return dispatch => basicAction({
      type: 'post',
      dispatch: dispatch,
      data,
      actionType: 'POST-API-CONFIRM',
      url: `${ApiTable.postApiConfirm}`,
      msg: { error: '添加确认信息失败' },
      reducer: { name: '' }
   });
}

export function getAlarmDataGroup () {   //获取数据告警分类
   return dispatch => basicAction({
      type: 'get',
      dispatch: dispatch,
      actionType: 'GET_ALARM_DATA_GROUP',
      url: `${ApiTable.getAlarmDataGroup}`,
      msg: { error: '获取数据告警分类失败' },
      reducer: { name: '' }
   });
}


export function getAlarmDataList (query) {   //查询数据告警列表
   return dispatch => basicAction({
      type: 'get',
      dispatch: dispatch,
      query,
      actionType: 'GET_ALARM_DATA_LIST',
      url: `${ApiTable.getAlarmDataList}`,
      msg: { error: '查询数据告警列表失败' },
      reducer: { name: '' }
   });
}

export function getAlarmDataDetail (query) {   //查询数据告警详情
   return dispatch => basicAction({
      type: 'get',
      dispatch: dispatch,
      query,
      actionType: 'GET_ALARM_DATA_DATAIL',
      url: `${ApiTable.getAlarmDataDetail}`,
      msg: { error: '查询数据告警详情失败' },
      reducer: { name: '' }
   });
}

export function getAlarmDataDetailAgg (query) {   //查询数据告警详情聚集数据
   return dispatch => basicAction({
      type: 'get',
      dispatch: dispatch,
      query,
      actionType: 'GET_ALARM_DATA_DATAIL_AGG',
      url: `${ApiTable.getAlarmDataDetailAgg}`,
      msg: { error: '查询数据告警详情聚集数据失败' },
      reducer: { name: '' }
   });
}