import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { DmsKnowledgeRepairVO, DmsKnowledgeRepairForm, DmsKnowledgeRepairQuery } from '@/api/dms/dmsKnowledgeRepair/types';

/**
 * 查询维修知识库列表
 * @param query
 * @returns {*}
 */

export const listDmsKnowledgeRepair = (query?: DmsKnowledgeRepairQuery): AxiosPromise<DmsKnowledgeRepairVO[]> => {
  return request({
    url: '/dms/dmsKnowledgeRepair/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询维修知识库详细
 * @param knowledgeRepairId
 */
export const getDmsKnowledgeRepair = (knowledgeRepairId: string | number): AxiosPromise<DmsKnowledgeRepairVO> => {
  return request({
    url: '/dms/dmsKnowledgeRepair/' + knowledgeRepairId,
    method: 'get'
  });
};

/**
 * 新增维修知识库
 * @param data
 */
export const addDmsKnowledgeRepair = (data: DmsKnowledgeRepairForm) => {
  return request({
    url: '/dms/dmsKnowledgeRepair',
    method: 'post',
    data: data
  });
};

/**
 * 修改维修知识库
 * @param data
 */
export const updateDmsKnowledgeRepair = (data: DmsKnowledgeRepairForm) => {
  return request({
    url: '/dms/dmsKnowledgeRepair',
    method: 'put',
    data: data
  });
};

/**
 * 删除维修知识库
 * @param knowledgeRepairId
 */
export const delDmsKnowledgeRepair = (knowledgeRepairId: string | number | Array<string | number>) => {
  return request({
    url: '/dms/dmsKnowledgeRepair/' + knowledgeRepairId,
    method: 'delete'
  });
};


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