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

#pragma once

#include <string>
#include "../include/tmg_sdk.h"
#include "bindings/jswrapper/SeApi.h"
#include "bindings/sebind/sebind.h"
#include "tmg_delegate_bindings.h"

class TMGContextBindings {
 public:
  TMGContextBindings();

  void setTMGDelegate(const se::Value& callback);
  void setRegion(const std::string& region);
  std::string getAuthBuffer(int app_id,
                            const std::string& room_id,
                            const std::string& user_id,
                            const std::string& key);
  int init(const std::string& app_id, const std::string& user_id);
  void poll();
  void pause();
  void resume();
  int uninit();
  int setScene(int scene);
  int setAudioRole(int role);
  int setRangeAudioMode(int mode);
  int setRangeAudioTeamID(int team_id);
  int enterRoom(const std::string& room_id, int room_type, const std::string& user_sig);
  int exitRoom();
  bool isRoomEntered();
  int setLogLevel(int level_write, int level_print);
  int setLogPath(const std::string& log_dir);
  std::string getLogPath();
  std::string getSDKVersion();
  void setAppVersion(const std::string& app_version);
  int showDebugView(bool show);
  int setRecvMixStreamCount(int count);
  int setAdvanceParams(const std::string& key, const std::string& value);
  std::string getAdvanceParams(const std::string& key);
  int checkMicPermission();

  ITMGContext* getTmgContext();

 private:
  ITMGContext* tmg_context_ = nullptr;
  std::shared_ptr<TMGDelegateBindings> tmg_delegate_;
};
