/*
 * @Author: sjl
 * @Date: 2023-06-11 19:21:25
 * @Descripttion:
 */
import { defHttp } from '/@/utils/http/axios';
import md5 from 'js-md5';

interface loginModel {
  username: string;
  password: string;
}

// var url = 'http://182.139.38.101:12080';
var url = '';

export const loginModel: loginModel = {
  username: 'tongfei',
  password: md5('spjk@1234'),
  // password: md5('tongfei'),
};

/**
 * 理工视频接口=>登录
 */
export const login = (params: any) =>
  defHttp.get<any>({
    // url: `/ligongVideoApi/user/login?username=${params.username}&password=${md5(params.password)}`,
    // // params,
    url: `${url}/ligongVideoApi/user/login`,
    params,
  });

/**
 * 理工视频接口=>查询设备信息
 */
export const getDevices = (params: any) =>
  defHttp.get<any>({
    url: `${url}/ligongVideoApi/device/query/devices`,
    params,
  });

/**
 * 理工视频接口=>查询设备通道信息
 */
export const getDevicesChannels = (params: any) =>
  defHttp.get<any>({
    url: `${url}/ligongVideoApi/device/query/devices/${params.deviceId}/channels`,
    params,
  });

/**
 * 理工视频接口=>开始播放
 */
export const playVideo = (params: any) =>
  defHttp.get<any>({
    url: `${url}/ligongVideoApi/play/start/${params.deviceId}/${params.channelId}`,
    params,
  });

/**
 * 理工视频接口=>结束播放
 */
export const stopVideo = (params: any) =>
  defHttp.get<any>({
    url: `${url}/ligongVideoApi/stop/start/${params.deviceId}/${params.channelId}`,
    params,
  });

/**
 * 理工视频接口=>云台控制
 */
export const controlVideo = (params: any) =>
  defHttp.get<any>({
    url: `${url}/ligongVideoApi/ptz/control/${params.deviceId}/${params.channelId}`,
    params,
  });
