import { defHttp } from '@/utils/http/axios';
import {
  StartLiveParams,
  SetCameraVideoParams,
  ExchangeCameraParams,
  AddOrUpdateRedisUserParams,
} from './model/index';

enum Api {
  StartLive = '/api/AirportMaintenance/StartLive',
  EndLive = '/api/AirportMaintenance/EndLive',
  SetCameraVideo = '/api/AirportMaintenance/SetCameraVideo',
  ExchangeCamera = '/api/AirportMaintenance/ExchangeCamera',
  GetRedisUser = '/api/AirportMaintenance/GetRedisUser',
  GetLockedClients = '/api/AirportMaintenance/GetLockedClients',
  AddOrUpdateRedisUser = '/api/AirportMaintenance/AddOrUpdateRedisUser',
}

export const startLive = (params: StartLiveParams) =>
  defHttp.post({
    url: Api.StartLive,
    params,
  });

export const endLive = (params: StartLiveParams) =>
  defHttp.post({
    url: Api.EndLive,
    params,
  });
export const setCameraVideo = (params: SetCameraVideoParams) =>
  defHttp.post({
    url: Api.SetCameraVideo,
    params,
  });

export const exchangeCamera = (params: ExchangeCameraParams) =>
  defHttp.post({
    url: Api.ExchangeCamera,
    params,
  });

export function getRedisUser(id) {
  return defHttp.get({ url: Api.GetRedisUser + '?id=' + id });
}

export function getLockedClients(params?: any) {
  return defHttp.get({ url: Api.GetLockedClients, params });
}
export const addOrUpdateRedisUser = (params: AddOrUpdateRedisUserParams) =>
  defHttp.post({
    url: Api.AddOrUpdateRedisUser,
    params,
  });
