import request from '@/utils/request'

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

// 查询设备详细
export function getDevice(id, sn = null) {
  return request({
    url: '/bst/device',
    method: 'get',
    params: {id, sn }
  })
}

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

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

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

// 设备入仓
export function inDevice(ids) {
  return request({
    url: '/bst/device/in',
    method: 'put',
    data: ids
  })
}

// 设备出仓
export function outDevice(ids) {
  return request({
    url: '/bst/device/out',
    method: 'put',
    data: ids
  })
}

// 设备禁用
export function disableDevice(ids) {
  return request({
    url: '/bst/device/disable',
    method: 'put',
    data: ids
  })
}

// 设备启用
export function enableDevice(ids) {
  return request({
    url: '/bst/device/enable',
    method: 'put',
    data: ids
  })
}
