import request from '@/utils/request'

// 查询device列表
export function listDevice(query) {
  return request({
    url: '/device/list',
    method: 'get',
    params: query
  })
}

// 查询device列表
export function listBindingDeviceUser(query) {
  return request({
    url: '/deviceControl/bindingList',
    method: 'get',
    params: query
  })
}

// 查询device列表
export function bindingUser(query) {
  return request({
    url: '/deviceControl/binding',
    method: 'get',
    params: query
  })
}

// 查询device列表
export function untieUser(query) {
  return request({
    url: '/deviceControl/untie',
    method: 'get',
    params: query
  })
}
// 查询device列表
export function listAllDeviceUser(query) {
  return request({
    url: '/deviceControl/allList',
    method: 'get',
    params: query
  })
}
// 查询device详细
export function getDevice(deviceId) {
  return request({
    url: '/device/' + deviceId,
    method: 'get'
  })
}

// 新增device
export function addDevice(data) {
  return request({
    url: '/device',
    method: 'post',
    data: data
  })
}

// 修改device
export function updateDevice(data) {
  return request({
    url: '/device',
    method: 'put',
    data: data
  })
}

// 删除device
export function delDevice(deviceId) {
  return request({
    url: '/device/' + deviceId,
    method: 'delete'
  })
}

// 导出device
export function exportDevice(query) {
  return request({
    url: '/device/export',
    method: 'get',
    params: query
  })
}

// 导出device
export function getAddressName(ln,la) {
  return request({
    url: 'https://api.map.baidu.com/reverse_geocoding/v3/?ak=dSx5st147PY0R2jZtiiedz0bgTyszGCY&output=json&coordtype=wgs84ll&location='+ln+","+la,
    method: 'get'
  })
}
