import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { FlfLevelConfigVO, FlfLevelConfigForm } from './types';

/**
 * 查询等级配置列表
 */
export const listAllLevelConfig = (): AxiosPromise<FlfLevelConfigVO[]> => {
  return request({
    url: '/fulfiller/levelConfig/listAll',
    method: 'get'
  });
};

/**
 * 新增等级配置
 * @param data
 */
export const addLevelConfig = (data: FlfLevelConfigForm): AxiosPromise<void> => {
  return request({
    url: '/fulfiller/levelConfig/add',
    method: 'post',
    data: data
  });
};

/**
 * 修改等级配置
 * @param data
 */
export const updateLevelConfig = (data: FlfLevelConfigForm): AxiosPromise<void> => {
  return request({
    url: '/fulfiller/levelConfig/edit',
    method: 'put',
    data: data
  });
};

/**
 * 编辑等级配置
 * @param data
 */
export const editLevelConfig = (data: FlfLevelConfigForm): AxiosPromise<void> => {
  return request({
    url: '/fulfiller/levelConfig/edit',
    method: 'put',
    data: data
  });
};

/**
 * 删除等级配置
 * @param id
 */
export const delLevelConfig = (id: string | number): AxiosPromise<void> => {
  return request({
    url: '/fulfiller/levelConfig/remove',
    method: 'delete',
    params: { id }
  });
};
