import request from '@/utils/request';
//查询传感器下触发器规则列表
export function getList(data) {
  var param =
    '?page=' +
    data.page +
    '&size=' +
    data.size +
    '&projectId=' +
    data.projectId;
  if (data.sensorName != '') {
    param += '&sensorName=' + data.sensorName;
  }
  return request({
    url: '/triggerRule/list' + param,
    method: 'get',
    data,
  });
}
//查询项目下的传感器列表
export function getSensorsData(data) {
  return request({
    url: '/triggerRule/sensors?projectId=' + data.projectId,
    method: 'get',
    data,
  });
}
//修改某个触发器规则
export function doEdit(data) {
  return request({
    url: '/triggerRule/update',
    method: 'post',
    data,
  });
}

export function doDelete(data) {
  return request({
    url: '/triggerRule/remove',
    method: 'post',
    data,
  });
}
//为某个传感器添加触发器规则
export function doAdd(data) {
  return request({
    url: '/triggerRule/add',
    method: 'post',
    data,
  });
}
//批量应用触发器规则到整个项目
export function triggerRuleUse(data) {
  return request({
    url: '/triggerRule/use',
    method: 'post',
    data,
  });
}
