import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { ConfigVO, ConfigForm, ConfigQuery, ConfigModelVO } from '@/api/system/modelConfig/types';

/**
 * 查询模型配置列表
 * @param query
 * @returns {*}
 */

export const listConfig = (query?: ConfigQuery): AxiosPromise<ConfigVO[]> => {
  return request({
    url: '/system/modelConfig/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询模型配置详细
 * @param id
 */
export const getConfig = (id: string | number): AxiosPromise<ConfigVO> => {
  return request({
    url: '/system/modelConfig/' + id,
    method: 'get'
  });
};

/**
 * 新增模型配置
 * @param data
 */
export const addConfig = (data: ConfigForm) => {
  return request({
    url: '/system/modelConfig',
    method: 'post',
    data: data
  });
};

/**
 * 修改模型配置
 * @param data
 */
export const updateConfig = (data: ConfigForm) => {
  return request({
    url: '/system/modelConfig',
    method: 'put',
    data: data
  });
};

/**
 * 删除模型配置
 * @param id
 */
export const delConfig = (id: string | number | Array<string | number>) => {
  return request({
    url: '/system/modelConfig/' + id,
    method: 'delete'
  });
};

export const listRerank = (query?: ConfigQuery): AxiosPromise<ConfigVO[]> => {
  return request({
    url: '/system/modelConfig/rerankList',
    method: 'get',
    params: query
  });
};

export const listModel = (query?: ConfigQuery): AxiosPromise<ConfigVO[]> => {
  return request({
    url: '/system/modelConfig/modelList',
    method: 'get',
    params: query
  });
};

export const updateConfigStatus = (id: string | number | Array<string | number>) => {
  return request({
    url: '/system/modelConfig/updateConfigStatus/' + id,
    method: 'put'
  });
};

export const getSysConfig = (): AxiosPromise<ConfigModelVO> => {
  return request({
    url: '/system/modelConfig/configList',
    method: 'get'
  });
};

export const editSysConfig = (data: ConfigForm) => {
  return request({
    url: '/system/modelConfig/editSysConfig',
    method: 'post',
    data: data
  });
};
