import request from '@/router/axios';

export const getList = (current, size, params) => {
  return request({
    url: '/api/cyzh-smart-device/videoclouddevice/list',
    method: 'get',
    params: {
      ...params,
      current,
      size,
    }
  })
}

export const getDetail = (id) => {
  return request({
    url: '/api/cyzh-smart-device/videoclouddevice/detail',
    method: 'get',
    params: {
      id
    }
  })
}

export const remove = (ids) => {
  return request({
    url: '/api/cyzh-smart-device/videoclouddevice/remove',
    method: 'post',
    params: {
      ids,
    }
  })
}

export const add = (row) => {
  return request({
    url: '/api/cyzh-smart-device/videoclouddevice/submit',
    method: 'post',
    data: row
  })
}

export const update = (row) => {
  return request({
    url: '/api/cyzh-smart-device/videoclouddevice/submit',
    method: 'post',
    data: row
  })
}

export const pageByBuilding = (current, size, params) => {
  return request({
    url: '/api/cyzh-smart-device/videoclouddevice/pageByBuilding',
    method: 'get',
    params: {
      ...params,
      current,
      size,
    }
  })
}
export const pushStream = (params) => {
  return request({
    url: '/api/cyzh-smart-device/videoclouddevice/pushStream',
    method: 'get',
    params: {
      ...params,
    }
  })
}

//启用拉流代理
export const start = (params) => {
  return request({
    url: '/api/cyzh-third/videocloud/proxy/start',
    method: 'get',
    params: {
      ...params,
    }
  })
}

//停用拉流代理
export const stop = (params) => {
  return request({
    url: '/api/cyzh-third/videocloud/proxy/stop',
    method: 'get',
    params: {
      ...params,
    }
  })
}

//播放拉流代理
export const play = (params) => {
  return request({
    url: '/api/cyzh-third/videocloud/proxy/play',
    method: 'get',
    params: {
      ...params,
    }
  })
}

//转码播放
export const convert = (streamId) => {
  return request({
    url: '/api/cyzh-third/videocloud/proxy/convert/' + streamId,
    method: 'get',
  })
}

//停止转码
export const convertStop = (convertKey) => {
  return request({
    url: '/api/cyzh-third/videocloud/proxy/convertKey/' + convertKey,
    method: 'get',
  })
}

//刷新设备信息
export const sync = (row) => {
  return request({
    url: '/api/cyzh-smart-device/videoclouddevice/syncByDevice',
    method: 'post',
    data: row
  })
}


export const updateVideoDevice = (row) => {
  return request({
    url: '/api/cyzh-smart-device/videoclouddevice/update',
    method: 'post',
    data: row
  })
}

export const bindResidentialBatch = (deviceIds,residentialId,buildingId) => {
  return request({
    url: '/api/cyzh-smart-device/videoclouddevice/bindResidentialBatch',
    method: 'post',
    params: {
      deviceIds,
      residentialId,
      buildingId
    }
  })
}
