import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { MonitorTaskVO, MonitorTaskForm, MonitorTaskQuery } from '@/api/manage/monitorTask/types';

/**
 * 查询任务管理列表
 * @param query
 * @returns {*}
 */

export const listMonitorTask = (query?: MonitorTaskQuery): AxiosPromise<MonitorTaskVO[]> => {
  return request({
    url: '/manage/monitorTask/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询任务管理详细
 * @param id
 */
export const getMonitorTask = (id: string | number): AxiosPromise<MonitorTaskVO> => {
  return request({
    url: '/manage/monitorTask/' + id,
    method: 'get'
  });
};

/**
 * 新增任务管理
 * @param data
 */
export const addMonitorTask = (data: MonitorTaskForm) => {
  return request({
    url: '/manage/monitorTask',
    method: 'post',
    data: data
  });
};

/**
 * 修改任务管理
 * @param data
 */
export const updateMonitorTask = (data: MonitorTaskForm) => {
  return request({
    url: '/manage/monitorTask',
    method: 'put',
    data: data
  });
};

/**
 * 删除任务管理
 * @param id
 */
export const delMonitorTask = (id: string | number | Array<string | number>) => {
  return request({
    url: '/manage/monitorTask/' + id,
    method: 'delete'
  });
};
/**
 * 根据监控点id获取任务数据
 * @param id
 */
export const getTaskInfoByPointId = (id) => {
  return request({
    url: '/manage/monitorTask/getTaskInfoByPointId/' + id,
    method: 'get'
  });
};
