import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { AlgorithmConfigVO, AlgorithmConfigForm, AlgorithmConfigQuery } from '@/api/manage/algorithmConfig/types';

/**
 * 查询算法仓配置列表
 * @param query
 * @returns {*}
 */

export const listAlgorithmConfig = (query?: AlgorithmConfigQuery): AxiosPromise<AlgorithmConfigVO[]> => {
  return request({
    url: '/manage/algorithmConfig/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询算法仓配置详细
 * @param id
 */
export const getAlgorithmConfig = (id: string | number): AxiosPromise<AlgorithmConfigVO> => {
  return request({
    url: '/manage/algorithmConfig/' + id,
    method: 'get'
  });
};

/**
 * 新增算法仓配置
 * @param data
 */
export const addAlgorithmConfig = (data: AlgorithmConfigForm) => {
  return request({
    url: '/manage/algorithmConfig',
    method: 'post',
    data: data
  });
};

/**
 * 修改算法仓配置
 * @param data
 */
export const updateAlgorithmConfig = (data: AlgorithmConfigForm) => {
  return request({
    url: '/manage/algorithmConfig',
    method: 'put',
    data: data
  });
};

/**
 * 删除算法仓配置
 * @param id
 */
export const delAlgorithmConfig = (id: string | number | Array<string | number>) => {
  return request({
    url: '/manage/algorithmConfig/' + id,
    method: 'delete'
  });
};
