import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { DmsInstanceFileVO, DmsInstanceFileForm, DmsInstanceFileQuery } from '@/api/dms/dmsInstanceFile/types';

/**
 * 查询维修工单文件列表
 * @param query
 * @returns {*}
 */

export const listDmsInstanceFile = (query?: DmsInstanceFileQuery): AxiosPromise<DmsInstanceFileVO[]> => {
  return request({
    url: '/dms/dmsInstanceFile/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询维修工单文件详细
 * @param instanceFileId
 */
export const getDmsInstanceFile = (instanceFileId: string | number): AxiosPromise<DmsInstanceFileVO> => {
  return request({
    url: '/dms/dmsInstanceFile/' + instanceFileId,
    method: 'get'
  });
};

/**
 * 新增维修工单文件
 * @param data
 */
export const addDmsInstanceFile = (data: DmsInstanceFileForm) => {
  return request({
    url: '/dms/dmsInstanceFile',
    method: 'post',
    data: data
  });
};

/**
 * 修改维修工单文件
 * @param data
 */
export const updateDmsInstanceFile = (data: DmsInstanceFileForm) => {
  return request({
    url: '/dms/dmsInstanceFile',
    method: 'put',
    data: data
  });
};

/**
 * 删除维修工单文件
 * @param instanceFileId
 */
export const delDmsInstanceFile = (instanceFileId: string | number | Array<string | number>) => {
  return request({
    url: '/dms/dmsInstanceFile/' + instanceFileId,
    method: 'delete'
  });
};


/**
 * 下拉框查询维修工单文件列表
 * @param query
 * @returns {*}
 */
export function getDmsInstanceFileList (query) {
    return request({
        url: '/dms/dmsInstanceFile/getDmsInstanceFileList',
        method: 'get',
        params: query
    });
};
