import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { AgentVO, AgentForm, AgentQuery } from '@/api/system/agent/types';

/**
 * 查询智能体列表
 * @param query
 * @returns {*}
 */

export const listAgent = (query?: AgentQuery): AxiosPromise<AgentVO[]> => {
  return request({
    url: '/system/agent/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询智能体详细
 * @param id
 */
export const getAgent = (id: string | number): AxiosPromise<AgentVO> => {
  return request({
    url: '/system/agent/' + id,
    method: 'get'
  });
};

/**
 * 新增智能体
 * @param data
 */
export const addAgent = (data: AgentForm) => {
  return request({
    url: '/system/agent',
    method: 'post',
    data: data
  });
};

/**
 * 修改智能体
 * @param data
 */
export const updateAgent = (data: AgentForm) => {
  return request({
    url: '/system/agent',
    method: 'put',
    data: data
  });
};

/**
 * 删除智能体
 * @param id
 */
export const delAgent = (id: string | number | Array<string | number>) => {
  return request({
    url: '/system/agent/' + id,
    method: 'delete'
  });
};
