import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { UserVO, UserForm, UserQuery } from '@/api/auth/user/types';

/**
 * 查询app用户列表
 * @param query
 * @returns {*}
 */

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

/**
 * 查询app用户详细
 * @param id
 */
export const getUser = (id: string | number): AxiosPromise<UserVO> => {
  return request({
    url: '/auth/user/getInfo/' + id,
    method: 'get'
  });
};


/**
 * 修改app用户
 * @param data
 */
export const updateUser = (data: UserForm) => {
  return request({
    url: '/appuser/edit',
    method: 'post',
    data: data
  });
};

/**
 * 删除app用户
 * @param id
 */
export const delUser = (id: string | number | Array<string | number>) => {
  return request({
    url: '/auth/user/remove/' + id,
    method: 'get'
  });
};
