import request, { apiGet } from '@/utils/request';

// 获取角色列表
export function getRoseList() {
  return request({
    url: '/api/get_role_list',
    method: 'get'
  });
}

export function getUserInfoApi(params) {
  return apiGet('/getUserInfo', params);
}
// 添加用户
export function addUserApi(data) {
  return request({
    url: '/api/add_user',
    method: 'post',
    data
  });
}

// 获取用户列表
export function getUserList(data) {
  return request({
    url: '/api/user_list',
    method: 'post',
    data
  });
}

//编辑用户
export function editUserApi(user_id, data) {
  return request({
    url: `/api/${user_id}`,
    method: 'put',
    data
  });
}

// 删除用户
export function deleteUserApi(user_id) {
  return request({
    url: `/api/delete_user/${user_id}`,
    method: 'delete'
  });
}

// 关机
export function shutDownApi() {
  return request({
    url: `/api/shut_down`,
    method: 'get'
  });
}

export function exitServiceApi() {
  return request({
    url: `/api/exit`,
    method: 'get'
  });
}

//重置修改密码
export function resetPwd(params) {
  return apiGet('/updateUserPassword', params);
}

export function getDeviceInfo() {
  return apiGet('/api/get_device_info');
}
export function setSafetyInfo(device_id, data) {
  return request({
    url: `/api/${device_id}`,
    method: 'put',
    data
  });
}
