import request from '@/utils/request';

//获取所有用户信息
export function getAllUsers() {
  return request({
    url: '/platform/getAllUsers',
    method: 'get',
  });
}

//获取租户用户
export function getTenantUsers(tenantId) {
  return request({
    url: `/platform/getTenantUsers/${tenantId}`,
    method: 'get',
  });
}
 
// 获取用户信息
export function getUserInfo(userId) {
  return request({
    url: `/platform/getUserInfo/${userId}`,
    method: 'get',
  });
}

// 添加用户
export function addUser(data) {
  return request({
    url: '/platform/addUser',
    method: 'post',
    data,
  });
}
 
// 编辑用户信息
export function editUser(userId, data) {
  return request({
    url: `/platform/editUser/${userId}`,
    method: 'post',
    data,
  });
}

// 更新用户信息（编辑用户的别名）
export function updateUserInfo(userId, data) {
  return editUser(userId, data);
}

// 删除用户
export function deleteUser(userId) {
  return request({
    url: `/platform/deleteUser/${userId}`,
    method: 'delete',
  });
}

// 修改密码
export function changePassword(userId, data) {
  return request({
    url: '/platform/changePassword',
    method: 'post',
    data: {
      id: userId,
      password: data.newPassword
    },
  });
}