import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { UserVO, UserForm, UserQuery, GrantForm } from '@/api/system/business/apiUsers/types';

/**
 * 查询【请填写功能名称】列表
 * @param query
 * @returns {*}
 */

export const listUser = (query?: UserQuery): AxiosPromise<UserVO[]> => {
  return request({
    url: '/business/user/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询【请填写功能名称】详细
 * @param id
 */
export const getUser = (id: string | number): AxiosPromise<UserVO> => {
  return request({
    url: '/business/user/' + id,
    method: 'get'
  });
};

/**
 * 新增【请填写功能名称】
 * @param data
 */
export const addUser = (data: UserForm) => {
  return request({
    url: '/business/user',
    method: 'post',
    data: data
  });
};

/**
 * 修改【请填写功能名称】
 * @param data
 */
export const updateUser = (data: UserForm) => {
  return request({
    url: '/business/user',
    method: 'put',
    data: data
  });
};

/**
 * 删除【请填写功能名称】
 * @param id
 */
export const delUser = (id: string | number | Array<string | number>) => {
  return request({
    url: '/business/user/' + id,
    method: 'delete'
  });
};

/**
 * 发送道具
 * @param data
 */
export const sendRewardToos = (data: GrantForm) => {
  return request({
    url: '/business/user/sendRewardToos',
    method: 'post',
    data: data
  });
};
