import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { DmsInspectProjectDeviceVO, DmsInspectProjectDeviceForm, DmsInspectProjectDeviceQuery } from '@/api/dms/dmsInspectProjectDevice/types';

/**
 * 查询点巡检项目关联设备信息列表
 * @param query
 * @returns {*}
 */

export const listDmsInspectProjectDevice = (query?: DmsInspectProjectDeviceQuery): AxiosPromise<DmsInspectProjectDeviceVO[]> => {
  return request({
    url: '/dms/dmsInspectProjectDevice/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询点巡检项目关联设备信息详细
 * @param inspectProjectId
 */
export const getDmsInspectProjectDevice = (inspectProjectId: string | number): AxiosPromise<DmsInspectProjectDeviceVO> => {
  return request({
    url: '/dms/dmsInspectProjectDevice/' + inspectProjectId,
    method: 'get'
  });
};

/**
 * 新增点巡检项目关联设备信息
 * @param data
 */
export const addDmsInspectProjectDevice = (data: DmsInspectProjectDeviceForm) => {
  return request({
    url: '/dms/dmsInspectProjectDevice',
    method: 'post',
    data: data
  });
};

/**
 * 修改点巡检项目关联设备信息
 * @param data
 */
export const updateDmsInspectProjectDevice = (data: DmsInspectProjectDeviceForm) => {
  return request({
    url: '/dms/dmsInspectProjectDevice',
    method: 'put',
    data: data
  });
};

/**
 * 删除点巡检项目关联设备信息
 * @param inspectProjectId
 */
export const delDmsInspectProjectDevice = (inspectProjectId: string | number | Array<string | number>) => {
  return request({
    url: '/dms/dmsInspectProjectDevice/' + inspectProjectId,
    method: 'delete'
  });
};


/**
 * 下拉框查询点巡检项目关联设备信息列表
 * @param query
 * @returns {*}
 */
export function getDmsInspectProjectDeviceList (query) {
    return request({
        url: '/dms/dmsInspectProjectDevice/getDmsInspectProjectDeviceList',
        method: 'get',
        params: query
    });
};
