import request from '@/utils/request'

// 修改密码
export function userInfoChange(data) {
  return request({
    url: '/uer/info/change',
    method: 'post',
    data
  })
}

// 设备信息
export function deviceInfo(query) {
  return request({
    url: '/device/info',
    method: 'get',
    params: query
  })
}

// 设备信息编辑
export function deviceEdit(data) {
  return request({
    url: '/device/edit',
    method: 'post',
    data
  })
}

// 节目(文件)查询
export function programList(query) {
  return request({
    url: '/program/info',
    method: 'get',
    params: query
  })
}

// 节目(文件)删除
export function programDelete(data) {
  return request({
    url: '/program/delete',
    method: 'post',
    data
  })
}

// 节目(文件)上传
export function programUpload(data) {
  return request({
    url: '/program/upload',
    method: 'post',
    data
  })
}

// 播放（设备）
export function programStart(data) {
  return request({
    url: '/program/start',
    method: 'post',
    data
  })
}

// 播放状态查询
export function playstatus(query) {
  return request({
    url: '/program/info/playstatus',
    method: 'get',
    params: query
  })
}

// 停止（设备）
export function programStop(data) {
  return request({
    url: '/program/stop',
    method: 'post',
    data
  })
}

// 节目(文件)编辑
export function programEdit(data) {
  return request({
    url: '/program/edit',
    method: 'post',
    data
  })
}

// 恢复出厂设置
export function deviceReset() {
  return request({
    url: '/device/reset',
    method: 'post'
  })
}

// 恢复出厂设置
export function deviceReboot() {
  return request({
    url: '/device/reboot',
    method: 'post'
  })
}

// 固件升级
export function firmwareUpdate(data) {
  return request({
    url: '/firmware/update',
    method: 'post',
    headers: {
      'Content-type': 'multipart-data-from'
    },
    data
  })
}

// 固件升级状态查询
export function firmwareStatus(query) {
  return request({
    url: '/firmware/status',
    method: 'get',
    params: query
  })
}

// 报警任务节目列表
export function getProgramAlarmInfo(data) {
  return request({
    url: '/program/alarm/info',
    method: 'post',
    data
  })
}

// 报警任务节目编辑
export function editProgramAlarm(data) {
  return request({
    url: '/program/alarm/edit',
    method: 'post',
    data
  })
}

// 日志列表
export function getLogList(query) {
  return request({
    url: '/log/list',
    method: 'get',
    params: query
  })
}

// 日志详情
export function getLogDetail(name) {
  return request({
    url: `/log/${name}`,
    method: 'get'
  })
}

// 日志删除
export function deteleLog(data) {
  return request({
    url: '/log/delete',
    method: 'post',
    data
  })
}

// 获取网络抓包信息
export function getPacketCaptureInfo(data) {
  return request({
    url: '/pcap/status',
    method: 'get',
    data
  })
}
// 开始抓包
export function startPacketCapture(data) {
  return request({
    url: '/pcap/start',
    method: 'post',
    data
  })
}
// 停止抓包
export function stopPacketCapture(data) {
  return request({
    url: '/pcap/stop',
    method: 'post',
    data
  })
}
// 删除抓包文件
export function deletePacketCapture(data) {
  return request({
    url: '/pcap/delete',
    method: 'post',
    data
  })
}
