import request from '@/utils/request'

// 查询设备列列表
export function listCamera(query) {
  // query.del_flag = 0
  return request({
    url: '/database_op/query_com_camera_condition.cgi',
    method: 'get',
    params: query,
	// headers: {
	//   isToken: false
	// },
  })
}

// 查询设备列详细
export function getCamera(id) {
  return request({
    url: '/database_op/query_com_camera_mainkey.cgi',
    method: 'get',
    params: {
      camera_id: id
    }
  })
}

// export function getCamera(id) {
//   return request({
//     headers: {
//       'Content-Type': 'application/x-www-form-urlencoded'
//     },
//     url: '/database_op/query_com_camera.cgi',
//     method: 'post',
//     data: JSON.stringify({
//       camera_id: id
//     }),
//     transformRequest: [function (data) {
//       let ret = ''
//       for (let it in data) {
//         ret += encodeURIComponent(it) + '=' + encodeURIComponent(data[it])
//       }
//       return `camera_id=${id}`
//     }]
//   })
// }

// 新增设备列
export function addCamera(data) {
  return request({
    url: '/database_op/insert_com_camera.cgi',
    method: 'post',
    data: data
  })
}

// 修改设备列
export function updateCamera(data) {
  return request({
    url: '/database_op/update_com_camera.cgi',
    method: 'post',
    data: data
  })
}

// 删除设备列
export function delCamera(id) {
  return request({
    url: '/database_op/delete_com_camera.cgi',
    method: 'post',
    data: {
      camera_id: id
    }
  })
}

// 导出设备列
export function getCameraPhoto(query) {
	return request({
	  url: '/database_op/display_rtsp.cgi',
	  method: 'post',
	  data:  {
			"rtsp_path": query
		}
	})
}


export function downloadCamera() {

}
// 导出设备列
export function exportCamera(query) {
  return request({
    url: '/camera/camera/export',
    method: 'get',
    params: query
  })
}