import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { DmsFaultInstanceActivityVO, DmsFaultInstanceActivityForm, DmsFaultInstanceActivityQuery } from '@/api/dms/dmsFaultInstanceActivity/types';

/**
 * 查询故障报修工单实例节点列表
 * @param query
 * @returns {*}
 */

export const listDmsFaultInstanceActivity = (query?: DmsFaultInstanceActivityQuery): AxiosPromise<DmsFaultInstanceActivityVO[]> => {
  return request({
    url: '/dms/dmsFaultInstanceActivity/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询故障报修工单实例节点详细
 * @param instanceActivityId
 */
export const getDmsFaultInstanceActivity = (instanceActivityId: string | number): AxiosPromise<DmsFaultInstanceActivityVO> => {
  return request({
    url: '/dms/dmsFaultInstanceActivity/' + instanceActivityId,
    method: 'get'
  });
};

/**
 * 新增故障报修工单实例节点
 * @param data
 */
export const addDmsFaultInstanceActivity = (data: DmsFaultInstanceActivityForm) => {
  return request({
    url: '/dms/dmsFaultInstanceActivity',
    method: 'post',
    data: data
  });
};

/**
 * 修改故障报修工单实例节点
 * @param data
 */
export const updateDmsFaultInstanceActivity = (data: DmsFaultInstanceActivityForm) => {
  return request({
    url: '/dms/dmsFaultInstanceActivity',
    method: 'put',
    data: data
  });
};

/**
 * 删除故障报修工单实例节点
 * @param instanceActivityId
 */
export const delDmsFaultInstanceActivity = (instanceActivityId: string | number | Array<string | number>) => {
  return request({
    url: '/dms/dmsFaultInstanceActivity/' + instanceActivityId,
    method: 'delete'
  });
};


/**
 * 下拉框查询故障报修工单实例节点列表
 * @param query
 * @returns {*}
 */
export function getDmsFaultInstanceActivityList (query) {
    return request({
        url: '/dms/dmsFaultInstanceActivity/getDmsFaultInstanceActivityList',
        method: 'get',
        params: query
    });
};
