import { request } from '@wisdom-utils/utils';

const REQUEST_METHOD_GET = 'get';
const REQUEST_METHOD_POST = 'post';
// eslint-disable-next-line no-undef
const navigatorAgent = /(iPhone|iOS|Android|Windows Phone)/i.test(navigator?.userAgent);
const baseURI = typeof DUMI_TYPE !== 'undefined' && DUMI_TYPE === 'dumi' ? '/api' : '';
const CommonPath = navigatorAgent ? '/PandaCore/GateWay' : '';

// 录像回放
export function videoPlayback(params) {
  return request({
    url: `${baseURI}${CommonPath}/pandavms/camera/playback`,
    method: REQUEST_METHOD_GET,
    params,
  });
}

// 根据时间轴时间选定 查看历史视频
export function newPlayback(params) {
  return request({
    url: `${baseURI}${CommonPath}/pandavms/camera/newpalyback`,
    method: REQUEST_METHOD_GET,
    params,
  });
}

// 云台控制
export function controlSlim(data) {
  return request({
    url: `${baseURI}${CommonPath}/pandavms/camera/control/slim`,
    method: REQUEST_METHOD_POST,
    data,
  });
}

// 获取isc ws回看流
export function hiswsUrl(data) {
  return request({
    url: `${baseURI}${CommonPath}/pandavms/camera/isc/hiswsurl`,
    method: REQUEST_METHOD_POST,
    data,
  });
}

// 更新海康ISC-RTSP协议直播流
export function updateStream(data) {
  return request({
    url: `${baseURI}${CommonPath}/pandavms/camera/isc/updatestream`,
    method: REQUEST_METHOD_POST,
    data,
  });
}