import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { InfoVO, InfoForm, InfoQuery } from '@/api/product/protocolInfo/types';

/**
 * 查询协议信息列表
 * @param query
 * @returns {*}
 */

export const listInfo = (query?: InfoQuery): AxiosPromise<InfoVO[]> => {
  return request({
    url: '/product/protocolInfo/list',
    method: 'get',
    params: query
  });
};



/**
 * 查询协议信息详细
 * @param id
 */
export const getInfo = (id: string | number): AxiosPromise<InfoVO> => {
  return request({
    url: '/product/protocolInfo/' + id,
    method: 'get'
  });
};

/**
 * 新增协议信息
 * @param data
 */
export const addInfo = (data: InfoForm) => {
  return request({
    url: '/product/protocolInfo',
    method: 'post',
    data: data
  });
};

/**
 * 修改协议信息
 * @param data
 */
export const updateInfo = (data: InfoForm) => {
  return request({
    url: '/product/protocolInfo',
    method: 'put',
    data: data
  });
};

/**
 * 删除协议信息
 * @param id
 */
export const delInfo = (id: string | number | Array<string | number>) => {
  return request({
    url: '/product/protocolInfo/' + id,
    method: 'delete'
  });
};
