import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { InspectInstanceDetailProjectVO, InspectInstanceDetailProjectForm, InspectInstanceDetailProjectQuery } from '@/api/dms/inspectInstanceDetailProject/types';

/**
 * 查询点巡检工单明细项目信息列表
 * @param query
 * @returns {*}
 */

export const listInspectInstanceDetailProject = (query?: InspectInstanceDetailProjectQuery): AxiosPromise<InspectInstanceDetailProjectVO[]> => {
  return request({
    url: '/dms/inspectInstanceDetailProject/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询点巡检工单明细项目信息详细
 * @param instanceDetailProjectId
 */
export const getInspectInstanceDetailProject = (instanceDetailProjectId: string | number): AxiosPromise<InspectInstanceDetailProjectVO> => {
  return request({
    url: '/dms/inspectInstanceDetailProject/' + instanceDetailProjectId,
    method: 'get'
  });
};

/**
 * 新增点巡检工单明细项目信息
 * @param data
 */
export const addInspectInstanceDetailProject = (data: InspectInstanceDetailProjectForm) => {
  return request({
    url: '/dms/inspectInstanceDetailProject',
    method: 'post',
    data: data
  });
};

/**
 * 修改点巡检工单明细项目信息
 * @param data
 */
export const updateInspectInstanceDetailProject = (data: InspectInstanceDetailProjectForm) => {
  return request({
    url: '/dms/inspectInstanceDetailProject',
    method: 'put',
    data: data
  });
};

/**
 * 删除点巡检工单明细项目信息
 * @param instanceDetailProjectId
 */
export const delInspectInstanceDetailProject = (instanceDetailProjectId: string | number | Array<string | number>) => {
  return request({
    url: '/dms/inspectInstanceDetailProject/' + instanceDetailProjectId,
    method: 'delete'
  });
};


/**
 * 下拉框查询点巡检工单明细项目信息列表
 * @param query
 * @returns {*}
 */
export function getDmsInspectInstanceDetailProjectList (query) {
    return request({
        url: '/dms/inspectInstanceDetailProject/getDmsInspectInstanceDetailProjectList',
        method: 'get',
        params: query
    });
};
