import { defHttp } from '/@/utils/http/axios';
import { setParams } from '/@/utils/index';
enum Api {
  sysUserAdd = '/sys/user/add',
  sysUserDetail = '/sys/user/detail',
  sysUserEdit = '/sys/user/edit',
  sysUserQueryAccountInfo = '/sys/user/query/accountInfo',
  sysUserQueryPage = '/sys/user/query/page',
  sysUserRemove = '/sys/user/deleteByIds',
  sysResetPwd = '/sys/user/reset/psw',

  userLoginInfo = '/user/loginInfo',
  userListMenus = '/user/listMenus-',
  userPermCode = '/user/getPermissionInfo',
  validatorUsername = '/sys/user/username/valid',
}

/**
 * @description: 新增用户,权限 - sys:user:add
 * @method: POST
 */
export const sysUserAdd = (params?: object) => {
  return defHttp.post({ url: Api.sysUserAdd, params: params });
};
/**
 * @description: 获取用户详细信息,权限 - sys:user:query
 * @method: GET
 */
export const sysUserDetail = (userId?: string) => {
  return defHttp.get({ url: Api.sysUserDetail + '/' + userId });
};
/**
 * @description: 通过主键id修改用户,权限 - sys:user:edit
 * @method: POST
 */
export const sysUserEdit = (params?: object) => {
  return defHttp.post({ url: Api.sysUserEdit, params: params });
};
/**
 * @description: 获取当前用户账户中心信息
 * @method: POST
 */
export const sysUserQueryAccountInfo = (params?: object) => {
  return defHttp.post({ url: Api.sysUserQueryAccountInfo, params: params });
};
/**
 * @description: 查询用户列表,权限 - sys:user:query
 * @method: POST
 */
export const sysUserQueryPage = (params?: object) => {
  return defHttp.post({ url: Api.sysUserQueryPage, params: setParams(params) });
};
/**
 * @description: 删除增用户,权限 - sys:user:remove
 * @method: POST
 */
export const sysUserRemove = (params?: object) => {
  return defHttp.post({ url: Api.sysUserRemove, params: params });
};

/**
 * @description: 删除增用户,权限 - sys:user:remove
 * @method: POST
 */
export const sysResetPwd = (params?: object) => {
  return defHttp.post({ url: Api.sysResetPwd, params: params });
};

/**
 * @description: 获取当前用户信息登录信息
 * @method: GET
 */
export const userLoginInfo = (params?: object) => {
  return defHttp.get({ url: Api.userLoginInfo, params: params });
};

/**
 * @description: 获取当前用户菜单
 * @method: GET
 */
export const userListMenus = (params?: object) => {
  return defHttp.get({ url: Api.userListMenus, params: params });
};
/**
 * @description: 获取当前用户权限标识
 * @method: GET
 */
export const userPermCode = (params?: object) => {
  return defHttp.get({ url: Api.userPermCode, params: params });
};

export const validatorUsername = (params?: object) => {
  return defHttp.post({ url: Api.validatorUsername, params: params });
};
