import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { MerchantPartnerVO, MerchantPartnerForm, MerchantPartnerQuery } from '@/api/system/physical/merchantPartner/types';

/**
 * 查询商城合作商家管理列表
 * @param query
 * @returns {*}
 */

export const listMerchantPartner = (query?: MerchantPartnerQuery): AxiosPromise<MerchantPartnerVO[]> => {
  return request({
    url: '/physical/merchantPartner/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询商城合作商家管理详细
 * @param id
 */
export const getMerchantPartner = (id: string | number): AxiosPromise<MerchantPartnerVO> => {
  return request({
    url: '/physical/merchantPartner/' + id,
    method: 'get'
  });
};

/**
 * 新增商城合作商家管理
 * @param data
 */
export const addMerchantPartner = (data: MerchantPartnerForm) => {
  return request({
    url: '/physical/merchantPartner',
    method: 'post',
    data: data
  });
};

/**
 * 修改商城合作商家管理
 * @param data
 */
export const updateMerchantPartner = (data: MerchantPartnerForm) => {
  return request({
    url: '/physical/merchantPartner',
    method: 'put',
    data: data
  });
};

/**
 * 删除商城合作商家管理
 * @param id
 */
export const delMerchantPartner = (id: string | number | Array<string | number>) => {
  return request({
    url: '/physical/merchantPartner/' + id,
    method: 'delete'
  });
};
/**
 * 查询所有商家
 */
export const selectPhysicalMerchantPartnerAllEnabled = (): AxiosPromise<MerchantPartnerVO> => {
  return request({
    url: '/physical/merchantPartner/selectPhysicalMerchantPartnerAllEnabled',
    method: 'get'
  });
};
