import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { PartnerVO, PartnerForm, PartnerQuery } from '@/api/permission/partner/types';

/**
 * 查询合作伙伴信息列表
 * @param query
 * @returns {*}
 */

export const listPartner = (query?: PartnerQuery): AxiosPromise<PartnerVO[]> => {
  return request({
    url: '/perm/partner/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询合作伙伴信息详细
 * @param id
 */
export const getPartner = (id: string | number): AxiosPromise<PartnerVO> => {
  return request({
    url: '/perm/partner/getInfo/' + id,
    method: 'get'
  });
};

/**
 * 新增合作伙伴信息
 * @param data
 */
export const addPartner = (data: PartnerForm) => {
  return request({
    url: '/perm/partner/add',
    method: 'post',
    data: data
  });
};

/**
 * 修改合作伙伴信息
 * @param data
 */
export const updatePartner = (data: PartnerForm) => {
  return request({
    url: '/perm/partner/edit',
    method: 'post',
    data: data
  });
};

/**
 * 删除合作伙伴信息
 * @param id
 */
export const delPartner = (id: string | number | Array<string | number>) => {
  return request({
    url: '/perm/partner/remove/' + id,
    method: 'get'
  });
};
