import request from '@/utils/request'

// 设备最新数据查询
const getDevInfo = (data) => {
  return request.get('device/recent-data', { params: data })
}

// 报警列表
const warnList = (data) => {
  return request.get('alarm/records', { params: data })
}
// 批量取消
const batchCancelled = (data) => {
  return request.get('alarm/batch/cancel', { params: data })
}
// 历史页面
const listPage = (data) => {
  return request.get('device/data/list-page', { params: data })
}
// 警告配置
const configWarn = (data) => {
  return request.post('alarm/config/add', data)
}
// 获取最新阀值
const gitNewVls = (data) => {
  return request.get(`device/level/${data}`)
}
// 视频地址
const getVideoUrl = (code) => {
  return request({
    url: '/hkvideo/getVideoUrl',
    method: 'post',
    data: {
      'appKey': '27091470',
      'appSecret': 'HWWgQzXsAncno5poYkPv',
      'data':
        {
          'cameraIndexCode': code,
          'streamType': 0,
          'protocol': 'hls',
          'transmode': 1,
          'expand': 'transcode=0',
          'streamform': 'ps'
        }
    }
  })
}
// 获取报警开关状态
const getAlarmSwitchStatus = () => {
  return request.get('alarm/push/query', { params: { scene: 'H2S' }})
}
const setAlarmSwitch = (params) => {
  return request.get('alarm/push/config', { params})
}
export { configWarn, listPage, warnList, batchCancelled, getDevInfo, gitNewVls, getVideoUrl, getAlarmSwitchStatus, setAlarmSwitch }
