import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { AiKnowledgeBaseTypeVO, AiKnowledgeBaseTypeForm, AiKnowledgeBaseTypeQuery } from '@/api/ai/base/aiKnowledgeBaseType/types';

/**
 * 查询AI知识库类型列表
 * @param query
 * @returns {*}
 */

export const listAiKnowledgeBaseType = (query?: AiKnowledgeBaseTypeQuery): AxiosPromise<AiKnowledgeBaseTypeVO[]> => {
  return request({
    url: '/ai/aiKnowledgeBaseType/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询AI知识库类型详细
 * @param knowledgeBaseTypeId
 */
export const getAiKnowledgeBaseType = (knowledgeBaseTypeId: string | number): AxiosPromise<AiKnowledgeBaseTypeVO> => {
  return request({
    url: '/ai/aiKnowledgeBaseType/' + knowledgeBaseTypeId,
    method: 'get'
  });
};

/**
 * 新增AI知识库类型
 * @param data
 */
export const addAiKnowledgeBaseType = (data: AiKnowledgeBaseTypeForm) => {
  return request({
    url: '/ai/aiKnowledgeBaseType',
    method: 'post',
    data: data
  });
};

/**
 * 修改AI知识库类型
 * @param data
 */
export const updateAiKnowledgeBaseType = (data: AiKnowledgeBaseTypeForm) => {
  return request({
    url: '/ai/aiKnowledgeBaseType',
    method: 'put',
    data: data
  });
};

/**
 * 删除AI知识库类型
 * @param knowledgeBaseTypeId
 */
export const delAiKnowledgeBaseType = (knowledgeBaseTypeId: string | number | Array<string | number>) => {
  return request({
    url: '/ai/aiKnowledgeBaseType/' + knowledgeBaseTypeId,
    method: 'delete'
  });
};


/**
 * 下拉框查询AI知识库类型列表
 * @param query
 * @returns {*}
 */
export function getAiKnowledgeBaseTypeList (query) {
    return request({
        url: '/ai/aiKnowledgeBaseType/getAiKnowledgeBaseTypeList',
        method: 'get',
        params: query
    });
};
