import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { ArExecutionVO, ArExecutionForm, ArExecutionQuery } from '@/api/inspection/execution/types';

/**
 * 查询任务执行记录列表
 * @param query
 * @returns {*}
 */
export const listArExecution = (query?: ArExecutionQuery): AxiosPromise<ArExecutionVO[]> => {
  return request({
    url: '/inspection/execution/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询任务执行记录详细
 * @param id
 */
export const getArExecution = (id: string | number): AxiosPromise<ArExecutionVO> => {
  return request({
    url: '/inspection/execution/' + id,
    method: 'get'
  });
};

/**
 * 新增任务执行记录
 * @param data
 */
export const addArExecution = (data: ArExecutionForm) => {
  return request({
    url: '/inspection/execution',
    method: 'post',
    data: data
  });
};

/**
 * 修改任务执行记录
 * @param data
 */
export const updateArExecution = (data: ArExecutionForm) => {
  return request({
    url: '/inspection/execution',
    method: 'put',
    data: data
  });
};

/**
 * 删除任务执行记录
 * @param id
 */
export const delArExecution = (id: string | number | Array<string | number>) => {
  return request({
    url: '/inspection/execution/' + id,
    method: 'delete'
  });
};
