import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { AiKnowledgeContentVO, AiKnowledgeContentForm, AiKnowledgeContentQuery } from '@/api/ai/aiKnowledgeContent/types';

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

export const listAiKnowledgeContent = (query?: AiKnowledgeContentQuery): AxiosPromise<AiKnowledgeContentVO[]> => {
  return request({
    url: '/ai/aiKnowledgeContent/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询AI知识库内容详细
 * @param knowledgeContentId
 */
export const getAiKnowledgeContent = (knowledgeContentId: string | number): AxiosPromise<AiKnowledgeContentVO> => {
  return request({
    url: '/ai/aiKnowledgeContent/' + knowledgeContentId,
    method: 'get'
  });
};

/**
 * 新增AI知识库内容
 * @param data
 */
export const addAiKnowledgeContent = (data: AiKnowledgeContentForm) => {
  return request({
    url: '/ai/aiKnowledgeContent',
    method: 'post',
    data: data
  });
};

/**
 * 修改AI知识库内容
 * @param data
 */
export const updateAiKnowledgeContent = (data: AiKnowledgeContentForm) => {
  return request({
    url: '/ai/aiKnowledgeContent',
    method: 'put',
    data: data
  });
};

/**
 * 删除AI知识库内容
 * @param knowledgeContentId
 */
export const delAiKnowledgeContent = (knowledgeContentId: string | number | Array<string | number>) => {
  return request({
    url: '/ai/aiKnowledgeContent/' + knowledgeContentId,
    method: 'delete'
  });
};


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