/// GENERATED BY terra, DO NOT MODIFY BY HAND.

// ignore_for_file: public_member_api_docs, unused_local_variable, unused_import, annotate_overrides

import 'package:agora_rtc_engine/src/binding_forward_export.dart';
import 'package:agora_rtc_engine/src/binding/impl_forward_export.dart';
import 'package:iris_method_channel/iris_method_channel.dart';

class H265TranscoderImpl implements H265Transcoder {
  H265TranscoderImpl(this.irisMethodChannel);

  @protected
  final IrisMethodChannel irisMethodChannel;

  @protected
  Map<String, dynamic> createParams(Map<String, dynamic> param) {
    return param;
  }

  @protected
  bool get isOverrideClassName => false;

  @protected
  String get className => 'H265Transcoder';

  @override
  Future<void> enableTranscode(
      {required String token,
      required String channel,
      required int uid}) async {
    final apiType =
        '${isOverrideClassName ? className : 'H265Transcoder'}_enableTranscode_a0779eb';
    final param =
        createParams({'token': token, 'channel': channel, 'uid': uid});
    final callApiResult = await irisMethodChannel.invokeMethod(
        IrisMethodCall(apiType, jsonEncode(param), buffers: null));
    if (callApiResult.irisReturnCode < 0) {
      throw AgoraRtcException(code: callApiResult.irisReturnCode);
    }
    final rm = callApiResult.data;
    final result = rm['result'];
    if (result < 0) {
      throw AgoraRtcException(code: result);
    }
  }

  @override
  Future<int> queryChannel(
      {required String token,
      required String channel,
      required int uid}) async {
    final apiType =
        '${isOverrideClassName ? className : 'H265Transcoder'}_queryChannel_a0779eb';
    final param =
        createParams({'token': token, 'channel': channel, 'uid': uid});
    final callApiResult = await irisMethodChannel.invokeMethod(
        IrisMethodCall(apiType, jsonEncode(param), buffers: null));
    if (callApiResult.irisReturnCode < 0) {
      throw AgoraRtcException(code: callApiResult.irisReturnCode);
    }
    final rm = callApiResult.data;
    final result = rm['result'];
    return result as int;
  }

  @override
  Future<void> triggerTranscode(
      {required String token,
      required String channel,
      required int uid}) async {
    final apiType =
        '${isOverrideClassName ? className : 'H265Transcoder'}_triggerTranscode_a0779eb';
    final param =
        createParams({'token': token, 'channel': channel, 'uid': uid});
    final callApiResult = await irisMethodChannel.invokeMethod(
        IrisMethodCall(apiType, jsonEncode(param), buffers: null));
    if (callApiResult.irisReturnCode < 0) {
      throw AgoraRtcException(code: callApiResult.irisReturnCode);
    }
    final rm = callApiResult.data;
    final result = rm['result'];
    if (result < 0) {
      throw AgoraRtcException(code: result);
    }
  }

  @override
  void registerTranscoderObserver(H265TranscoderObserver observer) {
    // Implementation template
// final apiType = '${isOverrideClassName ? className : 'H265Transcoder'}_registerTranscoderObserver_e1ee996';
// final param = createParams({
//   'observer': observer
// });
// final callApiResult = await irisMethodChannel.invokeMethod(IrisMethodCall(apiType, jsonEncode(param), buffers:null));
// if (callApiResult.irisReturnCode < 0) {
//   throw AgoraRtcException(code: callApiResult.irisReturnCode);
// }
// final rm = callApiResult.data;
// final result = rm['result'];
// if (result < 0) { throw AgoraRtcException(code: result); }
    throw UnimplementedError('Unimplement for registerTranscoderObserver');
  }

  @override
  void unregisterTranscoderObserver(H265TranscoderObserver observer) {
    // Implementation template
// final apiType = '${isOverrideClassName ? className : 'H265Transcoder'}_unregisterTranscoderObserver_e1ee996';
// final param = createParams({
//   'observer': observer
// });
// final callApiResult = await irisMethodChannel.invokeMethod(IrisMethodCall(apiType, jsonEncode(param), buffers:null));
// if (callApiResult.irisReturnCode < 0) {
//   throw AgoraRtcException(code: callApiResult.irisReturnCode);
// }
// final rm = callApiResult.data;
// final result = rm['result'];
// if (result < 0) { throw AgoraRtcException(code: result); }
    throw UnimplementedError('Unimplement for unregisterTranscoderObserver');
  }
}
