import request from '@/utils/request'

// 查询摄像头设备列表
export function listCamera(query) {
  return request({
    url: '/worn/camera/list',
    method: 'get',
    params: query
  })
}

// 查询摄像头设备详情
export function getCamera(id) {
  return request({
    url: '/worn/camera/' + id,
    method: 'get'
  })
}

// 新增摄像头设备
export function addCamera(data) {
  return request({
    url: '/worn/camera',
    method: 'post',
    data
  })
}

// 修改摄像头设备
export function updateCamera(data) {
  return request({
    url: '/worn/camera',
    method: 'put',
    data
  })
}

// 删除摄像头设备
export function delCamera(id) {
  return request({
    url: '/worn/camera/' + id,
    method: 'delete'
  })
}

// 获取摄像头播放地址
export function getCameraPlayUrl(deviceSerial) {
  return request({
    url: '/worn/camera/play',
    method: 'get',
    params: { deviceSerial }
  })
}

// 获取摄像头播放 token
export function getCameraPlayToken(deviceSerial) {
  return request({
    url: '/worn/camera/play/token',
    method: 'get',
    params: { deviceSerial }
  })
}
