import { requestClient } from '#/api/request';
/**
 * 分页查询
 * @param param
 */
async function queryPage(param) {
  return requestClient.post('/auth/role/queryPage', param);
}

/**
 * 查询当前用户可见角色
 * @param param
 */
async function queryVisible(param) {
  return requestClient.post('/auth/role/queryVisible', param);
}

/**
 * 查询用户关联角色
 * @param param
 */
async function queryRelationByUserUid(param) {
  return requestClient.post('/auth/role/queryRelationByUserUid/' + param.uid, param);
}

/**
 * 分配菜单
 */
async function assignMenuPermissionAndRemoveOld(param) {
  return requestClient.post('/auth/role/assignMenuPermissionAndRemoveOld', param);
}

/**
 * 创建角色
 * @param param
 */
async function addOne(param) {
  return requestClient.post('/auth/role/addOne', param);
}

/**
 * 删除角色
 * @param param
 */
async function removeByUid(param) {
  return requestClient.post('/auth/role/removeByUid/' + param.uid, param);
}

/**
 * 更新数据
 * @param param
 */
async function updateByUid(param) {
  return requestClient.post('/auth/role/updateByUid/' + param.uid, param);
}

export const role = {
  queryPage,
  queryVisible,
  queryRelationByUserUid,
  assignMenuPermissionAndRemoveOld,
  addOne,
  removeByUid,
  updateByUid,
}