import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { FlfLevelRightsVO, FlfLevelRightsForm } from './types';

/**
 * 查询等级权益库列表（全部）
 */
export const listAllLevelRights = (): AxiosPromise<FlfLevelRightsVO[]> => {
  return request({
    url: '/fulfiller/levelRights/listAll',
    method: 'get'
  });
};

/**
 * 新增等级权益
 * @param data
 */
export const addLevelRights = (data: FlfLevelRightsForm): AxiosPromise<void> => {
  return request({
    url: '/fulfiller/levelRights/add',
    method: 'post',
    data: data
  });
};

/**
 * 修改等级权益
 * @param data
 */
export const updateLevelRights = (data: FlfLevelRightsForm): AxiosPromise<void> => {
  return request({
    url: '/fulfiller/levelRights/edit',
    method: 'put',
    data: data
  });
};

/**
 * 修改等级权益状态
 * @param data
 */
export const changeLevelRightsStatus = (data: { id: number; status: boolean }): AxiosPromise<void> => {
  return request({
    url: '/fulfiller/levelRights/changeStatus',
    method: 'put',
    data: data
  });
};

/**
 * 删除等级权益
 * @param id
 */
export const delLevelRights = (id: string | number): AxiosPromise<void> => {
  return request({
    url: '/fulfiller/levelRights/remove/' + id,
    method: 'delete'
  });
};
