// Copyright (c) 2023 Tencent. All rights reserved.
// Author: felixyyan

#pragma once

#include <string>
#include "../include/av_audio_ctrl.h"
#include "bindings/sebind/sebind.h"
#include "tmg_context_bindings.h"

class TMGAudioCtrlBindings {
 public:
  explicit TMGAudioCtrlBindings(std::shared_ptr<TMGContextBindings> context_bindings);

  int enableMic(bool enable);
  int getMicState();
  int enableSpeaker(bool enable);
  int getSpeakerState();
  int enableAudioCaptureDevice(bool enable);
  bool isAudioCaptureDeviceEnabled();
  int enableAudioPlayDevice(bool enable);
  bool isAudioPlayDeviceEnabled();
  int enableAudioSend(bool enable);
  bool isAudioSendEnabled();
  int enableAudioRecv(bool enable);
  bool isAudioRecvEnabled();
  int setMicVolume(int volume);
  int getMicVolume();
  int setSpeakerVolume(int volume);
  int getSpeakerVolume();
  int setSpeakerVolumeByUserID(const std::string& user_id, int volume);
  int getSpeakerVolumeByUserID(const std::string& user_id);
  int enableLoopBack(bool enable);
  int setAudioRoute(ITMG_AUDIO_ROUTE route);
  int enableSpatializer(bool enable);
  bool isEnableSpatializer();
  int getMicListCount();
  ccstd::vector<se::Object*> getMicList(int n_count);
  int selectMic(const std::string& mic_id);
  se::Object* getCurrentMic();
  int getSpeakerListCount();
  ccstd::vector<se::Object*> getSpeakerList(int n_count);
  int selectSpeaker(const std::string& speaker_id);
  se::Object* getCurrentSpeaker();
  int trackingVolume(float interval);
  int stopTrackingVolume();
  int getMicLevel();
  int getSpeakerLevel();
  int getSendStreamLevel();
  int getRecvStreamLevel(const std::string& user_id);
  int startMicDeviceTest(int interval);
  int stopMicDeviceTest();
  int startSpeakerDeviceTest(const std::string& file_path);
  int stopSpeakerDeviceTest();
  int addAudioBlackList(const std::string& user_id);
  int removeAudioBlackList(const std::string& user_id);
  bool isUserIDInAudioBlackList(const std::string& user_id);

 private:
  ITMGAudioCtrl* audio_ctrl_ = nullptr;
};
