import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { ArTaskVO, ArTaskForm, ArTaskQuery } from '@/api/inspection/task/types';

/**
 * 查询巡检任务模板列表
 * @param query
 * @returns {*}
 */
export const listArTask = (query?: ArTaskQuery): AxiosPromise<ArTaskVO[]> => {
  return request({
    url: '/inspection/task/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询巡检任务模板详细
 * @param id
 */
export const getArTask = (id: string | number): AxiosPromise<ArTaskVO> => {
  return request({
    url: '/inspection/task/' + id,
    method: 'get'
  });
};

/**
 * 新增巡检任务模板
 * @param data
 */
export const addArTask = (data: ArTaskForm) => {
  return request({
    url: '/inspection/task',
    method: 'post',
    data: data
  });
};

/**
 * 修改巡检任务模板
 * @param data
 */
export const updateArTask = (data: ArTaskForm) => {
  return request({
    url: '/inspection/task',
    method: 'put',
    data: data
  });
};

/**
 * 删除巡检任务模板
 * @param id
 */
export const delArTask = (id: string | number | Array<string | number>) => {
  return request({
    url: '/inspection/task/' + id,
    method: 'delete'
  });
};
