import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { DmsRecordInspectVO, DmsRecordInspectForm, DmsRecordInspectQuery } from '@/api/dms/dmsRecordInspect/types';

/**
 * 查询点巡检历史记录列表
 * @param query
 * @returns {*}
 */

export const listDmsRecordInspect = (query?: DmsRecordInspectQuery): AxiosPromise<DmsRecordInspectVO[]> => {
  return request({
    url: '/dms/dmsRecordInspect/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询点巡检历史记录详细
 * @param recordInspectId
 */
export const getDmsRecordInspect = (recordInspectId: string | number): AxiosPromise<DmsRecordInspectVO> => {
  return request({
    url: '/dms/dmsRecordInspect/' + recordInspectId,
    method: 'get'
  });
};

/**
 * 新增点巡检历史记录
 * @param data
 */
export const addDmsRecordInspect = (data: DmsRecordInspectForm) => {
  return request({
    url: '/dms/dmsRecordInspect',
    method: 'post',
    data: data
  });
};

/**
 * 修改点巡检历史记录
 * @param data
 */
export const updateDmsRecordInspect = (data: DmsRecordInspectForm) => {
  return request({
    url: '/dms/dmsRecordInspect',
    method: 'put',
    data: data
  });
};

/**
 * 删除点巡检历史记录
 * @param recordInspectId
 */
export const delDmsRecordInspect = (recordInspectId: string | number | Array<string | number>) => {
  return request({
    url: '/dms/dmsRecordInspect/' + recordInspectId,
    method: 'delete'
  });
};


/**
 * 下拉框查询点巡检历史记录列表
 * @param query
 * @returns {*}
 */
export function getDmsRecordInspectList (query) {
    return request({
        url: '/dms/dmsRecordInspect/getDmsRecordInspectList',
        method: 'get',
        params: query
    });
};
