import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { ArStepRecordVO, ArStepRecordForm, ArStepRecordQuery } from '@/api/inspection/stepRecord/types';

/**
 * 查询步骤执行记录列表
 * @param query
 * @returns {*}
 */
export const listArStepRecord = (query?: ArStepRecordQuery): AxiosPromise<ArStepRecordVO[]> => {
  return request({
    url: '/inspection/stepRecord/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询步骤执行记录详细
 * @param id
 */
export const getArStepRecord = (id: string | number): AxiosPromise<ArStepRecordVO> => {
  return request({
    url: '/inspection/stepRecord/' + id,
    method: 'get'
  });
};

/**
 * 新增步骤执行记录
 * @param data
 */
export const addArStepRecord = (data: ArStepRecordForm) => {
  return request({
    url: '/inspection/stepRecord',
    method: 'post',
    data: data
  });
};

/**
 * 修改步骤执行记录
 * @param data
 */
export const updateArStepRecord = (data: ArStepRecordForm) => {
  return request({
    url: '/inspection/stepRecord',
    method: 'put',
    data: data
  });
};

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