import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { VendorconfigVO, VendorconfigForm, VendorconfigQuery } from '@/api/msg/vendorconfig/types';

/**
 * 查询服务商配置列表
 * @param query
 * @returns {*}
 */

export const listVendorconfig = (query?: VendorconfigQuery): AxiosPromise<VendorconfigVO[]> => {
  return request({
    url: '/msg/vendorconfig/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询服务商配置详细
 * @param vendorId
 */
export const getVendorconfig = (vendorId: string | number): AxiosPromise<VendorconfigVO> => {
  return request({
    url: '/msg/vendorconfig/' + vendorId,
    method: 'get'
  });
};

/**
 * 新增服务商配置
 * @param data
 */
export const addVendorconfig = (data: VendorconfigForm) => {
  return request({
    url: '/msg/vendorconfig',
    method: 'post',
    data: data
  });
};

/**
 * 修改服务商配置
 * @param data
 */
export const updateVendorconfig = (data: VendorconfigForm) => {
  return request({
    url: '/msg/vendorconfig',
    method: 'put',
    data: data
  });
};

/**
 * 删除服务商配置
 * @param vendorId
 */
export const delVendorconfig = (vendorId: string | number | Array<string | number>) => {
  return request({
    url: '/msg/vendorconfig/' + vendorId,
    method: 'delete'
  });
};
