import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { DmsKnowledgeLubeVO, DmsKnowledgeLubeForm, DmsKnowledgeLubeQuery } from '@/api/dms/dmsKnowledgeLube/types';

/**
 * 查询润滑知识库列表
 * @param query
 * @returns {*}
 */

export const listDmsKnowledgeLube = (query?: DmsKnowledgeLubeQuery): AxiosPromise<DmsKnowledgeLubeVO[]> => {
  return request({
    url: '/dms/dmsKnowledgeLube/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询润滑知识库详细
 * @param knowledgeLubeId
 */
export const getDmsKnowledgeLube = (knowledgeLubeId: string | number): AxiosPromise<DmsKnowledgeLubeVO> => {
  return request({
    url: '/dms/dmsKnowledgeLube/' + knowledgeLubeId,
    method: 'get'
  });
};

/**
 * 新增润滑知识库
 * @param data
 */
export const addDmsKnowledgeLube = (data: DmsKnowledgeLubeForm) => {
  return request({
    url: '/dms/dmsKnowledgeLube',
    method: 'post',
    data: data
  });
};

/**
 * 修改润滑知识库
 * @param data
 */
export const updateDmsKnowledgeLube = (data: DmsKnowledgeLubeForm) => {
  return request({
    url: '/dms/dmsKnowledgeLube',
    method: 'put',
    data: data
  });
};

/**
 * 删除润滑知识库
 * @param knowledgeLubeId
 */
export const delDmsKnowledgeLube = (knowledgeLubeId: string | number | Array<string | number>) => {
  return request({
    url: '/dms/dmsKnowledgeLube/' + knowledgeLubeId,
    method: 'delete'
  });
};


/**
 * 下拉框查询润滑知识库列表
 * @param query
 * @returns {*}
 */
export function getDmsKnowledgeLubeList (query) {
    return request({
        url: '/dms/dmsKnowledgeLube/getDmsKnowledgeLubeList',
        method: 'get',
        params: query
    });
};
