import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { MemberLevelConfigVO, MemberLevelConfigForm, MemberLevelConfigQuery } from '@/api/system/physical/memberLevelConfig/types';

/**
 * 查询会员等级权益配置列表
 * @param query
 * @returns {*}
 */

export const listMemberLevelConfig = (query?: MemberLevelConfigQuery): AxiosPromise<MemberLevelConfigVO[]> => {
  return request({
    url: '/physical/memberLevelConfig/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询会员等级权益配置详细
 * @param id
 */
export const getMemberLevelConfig = (id: string | number): AxiosPromise<MemberLevelConfigVO> => {
  return request({
    url: '/physical/memberLevelConfig/' + id,
    method: 'get'
  });
};

/**
 * 新增会员等级权益配置
 * @param data
 */
export const addMemberLevelConfig = (data: MemberLevelConfigForm) => {
  return request({
    url: '/physical/memberLevelConfig',
    method: 'post',
    data: data
  });
};

/**
 * 修改会员等级权益配置
 * @param data
 */
export const updateMemberLevelConfig = (data: MemberLevelConfigForm) => {
  return request({
    url: '/physical/memberLevelConfig',
    method: 'put',
    data: data
  });
};

/**
 * 删除会员等级权益配置
 * @param id
 */
export const delMemberLevelConfig = (id: string | number | Array<string | number>) => {
  return request({
    url: '/physical/memberLevelConfig/' + id,
    method: 'delete'
  });
};
