import 'dart:ffi';
import '../../tmg_audio_ctrl.dart';
import '../../tmg_error.dart';
import '../../bindings/v2/tmg_audio_ctrl_bindings.dart' as TMGAudioCtrlBindings;

class TMGAudioCtrlImpl extends ITMGAudioCtrl {
  late final TMGAudioCtrlBindings.TMGAudioCtrlBindings _instance;
  final int DEFAULT_VALUE = 100;
  TMGAudioCtrlImpl() {
    _instance = new TMGAudioCtrlBindings.TMGAudioCtrlBindings();
  }

  @override
  int EnableMic(bool enable) {
    return _instance.EnableMic(enable);
  }

  @override
  int GetMicState() {
    return _instance.GetMicState();
  }

  @override
  int EnableSpeaker(bool enable) {
    return _instance.EnableSpeaker(enable);
  }

  @override
  int GetSpeakerState() {
    return _instance.GetSpeakerState();
  }

  @override
  int EnableAudioCaptureDevice(bool enable) {
    return _instance.EnableAudioCaptureDevice(enable);
  }

  @override
  bool IsAudioCaptureDeviceEnabled() {
    return _instance.IsAudioCaptureDeviceEnabled();
  }

  @override
  int EnableAudioPlayDevice(bool enable) {
    return TMGError.AV_ERR_NOT_IMPLEMENTED;
  }

  @override
  bool IsAudioPlayDeviceEnabled() {
    return false;
  }

  @override
  int EnableAudioSend(bool enable) {
    return _instance.EnableAudioSend(enable);
  }

  @override
  bool IsAudioSendEnabled() {
    return _instance.IsAudioSendEnabled();
  }

  @override
  int EnableAudioRecv(bool enable) {
    return TMGError.AV_ERR_NOT_IMPLEMENTED;
  }

  @override
  bool IsAudioRecvEnabled() {
    return false;
  }

  @override
  int SetMicVolume(int volume) {
    return _instance.SetMicVolume(volume);
  }

  @override
  int GetMicVolume() {
    return _instance.GetMicVolume();
  }

  @override
  int SetSpeakerVolume(int volume) {
    return TMGError.AV_ERR_NOT_IMPLEMENTED;
  }

  @override
  int GetSpeakerVolume() {
    return DEFAULT_VALUE;
  }

  @override
  int SetSpeakerVolumeByUserID(String userID, int volume) {
    return TMGError.AV_ERR_NOT_IMPLEMENTED;
  }

  @override
  int GetSpeakerVolumeByUserID(String userID) {
    return TMGError.AV_ERR_NOT_IMPLEMENTED;
  }

  @override
  int EnableLoopBack(bool enable) {
    return _instance.EnableLoopBack(enable);
  }

  @override
  int SetLoopBackVolume(int volume) {
    return TMGError.AV_ERR_NOT_IMPLEMENTED;
  }

  @override
  int AddAudioBlackList(String userID) {
    return _instance.AddAudioBlackList(userID);
  }

  @override
  int RemoveAudioBlackList(String userID) {
    return _instance.RemoveAudioBlackList(userID);
  }

  @override
  bool IsUserIDInAudioBlackList(String userID) {
    return _instance.IsUserIDInAudioBlackList(userID);
  }

  @override
  int EnableSpatializer(bool enable) {
    return TMGError.AV_ERR_NOT_IMPLEMENTED;
  }

  @override
  bool IsEnableSpatializer() {
    return false;
  }

  @override
  int TrackingVolume(double interval) {
    return _instance.TrackingVolume(interval);
  }

  @override
  int StopTrackingVolume() {
    return _instance.StopTrackingVolume();
  }

  @override
  int GetMicLevel() {
    return DEFAULT_VALUE;
  }

  @override
  int GetSpeakerLevel() {
    return DEFAULT_VALUE;
  }

  @override
  int GetSendStreamLevel() {
    return DEFAULT_VALUE;
  }

  @override
  int GetRecvStreamLevel(String userID) {
    return DEFAULT_VALUE;
  }
}
