// ignore_for_file: non_constant_identifier_names, camel_case_types, missing_return, unused_import, unused_local_variable, dead_code, unnecessary_cast
//////////////////////////////////////////////////////////
// GENERATED BY FLUTTIFY. DO NOT EDIT IT.
//////////////////////////////////////////////////////////

import 'dart:typed_data';

import 'package:tencent_live_fluttify/src/ios/ios.export.g.dart';
import 'package:flutter/foundation.dart';
import 'package:flutter/services.dart';

import 'package:foundation_fluttify/foundation_fluttify.dart';

class TXVideoJoiner extends NSObject  {
  //region constants
  static const String name__ = 'TXVideoJoiner';

  
  //endregion

  //region creators
  static Future<TXVideoJoiner> create__({ bool init = true /* ios only */ }) async {
    final refId = await MethodChannel('com.fluttify/tencent_live_fluttify', StandardMethodCodec(FluttifyMessageCodec('tencent_live_fluttify'))).invokeMethod('ObjectFactory::createTXVideoJoiner', {'init': init});
    final object = TXVideoJoiner()..refId = refId..tag__ = 'tencent_live_fluttify';
    return object;
  }
  
  static Future<List<TXVideoJoiner>> create_batch__(int length, { bool init = true /* ios only */ }) async {
    if (false) {
      return Future.error('all args must have same length!');
    }
    final List resultBatch = await MethodChannel('com.fluttify/tencent_live_fluttify', StandardMethodCodec(FluttifyMessageCodec('tencent_live_fluttify'))).invokeMethod('ObjectFactory::create_batchTXVideoJoiner', {'length': length, 'init': init});
  
    final List<TXVideoJoiner> typedResult = resultBatch.map((result) => TXVideoJoiner()..refId = result..tag__ = 'tencent_live_fluttify').toList();
    return typedResult;
  }
  
  //endregion

  //region getters
  
  //endregion

  //region setters
  Future<void> set_joinerDelegate(TXVideoJoinerListener joinerDelegate) async {
    await MethodChannel('com.fluttify/tencent_live_fluttify', StandardMethodCodec(FluttifyMessageCodec('tencent_live_fluttify'))).invokeMethod('TXVideoJoiner::set_joinerDelegate', <String, dynamic>{'__this__': this, });
  
    MethodChannel('TXVideoJoinerListener::Callback', StandardMethodCodec(FluttifyMessageCodec('tencent_live_fluttify')))
      .setMethodCallHandler((methodCall) async {
        try {
          final args = methodCall.arguments as Map;
          switch (methodCall.method) {
            case 'Callback::TXVideoJoinerListener::onJoinProgress':
              // print log
              if (fluttifyLogEnabled) {
                debugPrint('fluttify-dart-callback: onJoinProgress([\'progress\':${args['progress']}])');
              }
          
              // handle the native call
              joinerDelegate?.onJoinProgress(args['progress']);
              break;
            case 'Callback::TXVideoJoinerListener::onJoinComplete':
              // print log
              if (fluttifyLogEnabled) {
                debugPrint('fluttify-dart-callback: onJoinComplete([\'result\':${args['result']}])');
              }
          
              // handle the native call
              joinerDelegate?.onJoinComplete(TypeOpTencentLiveFluttifyIOS((args['result'] as Object))?.as__<TXJoinerResult>());
              break;
            default:
              break;
          }
        } catch (e) {
          debugPrint(e);
          throw e;
        }
      });
  }
  
  Future<void> set_previewDelegate(TXVideoPreviewListener previewDelegate) async {
    await MethodChannel('com.fluttify/tencent_live_fluttify', StandardMethodCodec(FluttifyMessageCodec('tencent_live_fluttify'))).invokeMethod('TXVideoJoiner::set_previewDelegate', <String, dynamic>{'__this__': this, });
  
    MethodChannel('TXVideoPreviewListener::Callback', StandardMethodCodec(FluttifyMessageCodec('tencent_live_fluttify')))
      .setMethodCallHandler((methodCall) async {
        try {
          final args = methodCall.arguments as Map;
          switch (methodCall.method) {
            case 'Callback::TXVideoPreviewListener::onPreviewProgress':
              // print log
              if (fluttifyLogEnabled) {
                debugPrint('fluttify-dart-callback: onPreviewProgress([\'time\':${args['time']}])');
              }
          
              // handle the native call
              previewDelegate?.onPreviewProgress(args['time']);
              break;
            case 'Callback::TXVideoPreviewListener::onPreviewFinished':
              // print log
              if (fluttifyLogEnabled) {
                debugPrint('fluttify-dart-callback: onPreviewFinished([])');
              }
          
              // handle the native call
              previewDelegate?.onPreviewFinished();
              break;
            default:
              break;
          }
        } catch (e) {
          debugPrint(e);
          throw e;
        }
      });
  }
  
  //endregion

  //region methods
  
  Future<TXVideoJoiner> initWithPreview(TXPreviewParam param) async {
    // print log
    if (fluttifyLogEnabled) {
      debugPrint('fluttify-dart: TXVideoJoiner@$refId::initWithPreview([])');
    }
  
    // invoke native method
    final __result__ = await MethodChannel('com.fluttify/tencent_live_fluttify', StandardMethodCodec(FluttifyMessageCodec('tencent_live_fluttify'))).invokeMethod('TXVideoJoiner::initWithPreview', {"param": param, "__this__": this});
  
  
    // handle native call
  
  
    // convert native result to dart side object
    if (__result__ == null) {
      return null;
    } else {
      final __return__ = TXVideoJoiner()..refId = __result__..tag__ = 'tencent_live_fluttify';
      return __return__;
    }
  }
  
  
  Future<int> setVideoPathList(List<dynamic> videoPathList) async {
    // print log
    if (fluttifyLogEnabled) {
      debugPrint('fluttify-dart: TXVideoJoiner@$refId::setVideoPathList([])');
    }
  
    // invoke native method
    final __result__ = await MethodChannel('com.fluttify/tencent_live_fluttify', StandardMethodCodec(FluttifyMessageCodec('tencent_live_fluttify'))).invokeMethod('TXVideoJoiner::setVideoPathList', {"videoPathList": videoPathList, "__this__": this});
  
  
    // handle native call
  
  
    // convert native result to dart side object
    if (__result__ == null) {
      return null;
    } else {
      final __return__ = __result__;
      return __return__;
    }
  }
  
  
  Future<void> setVideoVolumes(List<num> volumes) async {
    // print log
    if (fluttifyLogEnabled) {
      debugPrint('fluttify-dart: TXVideoJoiner@$refId::setVideoVolumes([\'volumes\':$volumes])');
    }
  
    // invoke native method
    final __result__ = await MethodChannel('com.fluttify/tencent_live_fluttify', StandardMethodCodec(FluttifyMessageCodec('tencent_live_fluttify'))).invokeMethod('TXVideoJoiner::setVideoVolumes', {"volumes": volumes, "__this__": this});
  
  
    // handle native call
  
  
    // convert native result to dart side object
    if (__result__ == null) {
      return null;
    } else {
      final __return__ = __result__;
      return __return__;
    }
  }
  
  
  Future<void> startPlay() async {
    // print log
    if (fluttifyLogEnabled) {
      debugPrint('fluttify-dart: TXVideoJoiner@$refId::startPlay([])');
    }
  
    // invoke native method
    final __result__ = await MethodChannel('com.fluttify/tencent_live_fluttify', StandardMethodCodec(FluttifyMessageCodec('tencent_live_fluttify'))).invokeMethod('TXVideoJoiner::startPlay', {"__this__": this});
  
  
    // handle native call
  
  
    // convert native result to dart side object
    if (__result__ == null) {
      return null;
    } else {
      final __return__ = __result__;
      return __return__;
    }
  }
  
  
  Future<void> pausePlay() async {
    // print log
    if (fluttifyLogEnabled) {
      debugPrint('fluttify-dart: TXVideoJoiner@$refId::pausePlay([])');
    }
  
    // invoke native method
    final __result__ = await MethodChannel('com.fluttify/tencent_live_fluttify', StandardMethodCodec(FluttifyMessageCodec('tencent_live_fluttify'))).invokeMethod('TXVideoJoiner::pausePlay', {"__this__": this});
  
  
    // handle native call
  
  
    // convert native result to dart side object
    if (__result__ == null) {
      return null;
    } else {
      final __return__ = __result__;
      return __return__;
    }
  }
  
  
  Future<void> resumePlay() async {
    // print log
    if (fluttifyLogEnabled) {
      debugPrint('fluttify-dart: TXVideoJoiner@$refId::resumePlay([])');
    }
  
    // invoke native method
    final __result__ = await MethodChannel('com.fluttify/tencent_live_fluttify', StandardMethodCodec(FluttifyMessageCodec('tencent_live_fluttify'))).invokeMethod('TXVideoJoiner::resumePlay', {"__this__": this});
  
  
    // handle native call
  
  
    // convert native result to dart side object
    if (__result__ == null) {
      return null;
    } else {
      final __return__ = __result__;
      return __return__;
    }
  }
  
  
  Future<void> stopPlay() async {
    // print log
    if (fluttifyLogEnabled) {
      debugPrint('fluttify-dart: TXVideoJoiner@$refId::stopPlay([])');
    }
  
    // invoke native method
    final __result__ = await MethodChannel('com.fluttify/tencent_live_fluttify', StandardMethodCodec(FluttifyMessageCodec('tencent_live_fluttify'))).invokeMethod('TXVideoJoiner::stopPlay', {"__this__": this});
  
  
    // handle native call
  
  
    // convert native result to dart side object
    if (__result__ == null) {
      return null;
    } else {
      final __return__ = __result__;
      return __return__;
    }
  }
  
  
  Future<void> joinVideo_videoOutputPath(TXVideoCompressed videoCompressed, String videoOutputPath) async {
    // print log
    if (fluttifyLogEnabled) {
      debugPrint('fluttify-dart: TXVideoJoiner@$refId::joinVideo([\'videoOutputPath\':$videoOutputPath])');
    }
  
    // invoke native method
    final __result__ = await MethodChannel('com.fluttify/tencent_live_fluttify', StandardMethodCodec(FluttifyMessageCodec('tencent_live_fluttify'))).invokeMethod('TXVideoJoiner::joinVideo_videoOutputPath', {"videoCompressed": videoCompressed.toValue(), "videoOutputPath": videoOutputPath, "__this__": this});
  
  
    // handle native call
  
  
    // convert native result to dart side object
    if (__result__ == null) {
      return null;
    } else {
      final __return__ = __result__;
      return __return__;
    }
  }
  
  
  Future<void> splitJoinVideo_videoOutputPath(TXVideoCompressed videoCompressed, String videoOutputPath) async {
    // print log
    if (fluttifyLogEnabled) {
      debugPrint('fluttify-dart: TXVideoJoiner@$refId::splitJoinVideo([\'videoOutputPath\':$videoOutputPath])');
    }
  
    // invoke native method
    final __result__ = await MethodChannel('com.fluttify/tencent_live_fluttify', StandardMethodCodec(FluttifyMessageCodec('tencent_live_fluttify'))).invokeMethod('TXVideoJoiner::splitJoinVideo_videoOutputPath', {"videoCompressed": videoCompressed.toValue(), "videoOutputPath": videoOutputPath, "__this__": this});
  
  
    // handle native call
  
  
    // convert native result to dart side object
    if (__result__ == null) {
      return null;
    } else {
      final __return__ = __result__;
      return __return__;
    }
  }
  
  
  Future<void> cancelJoin() async {
    // print log
    if (fluttifyLogEnabled) {
      debugPrint('fluttify-dart: TXVideoJoiner@$refId::cancelJoin([])');
    }
  
    // invoke native method
    final __result__ = await MethodChannel('com.fluttify/tencent_live_fluttify', StandardMethodCodec(FluttifyMessageCodec('tencent_live_fluttify'))).invokeMethod('TXVideoJoiner::cancelJoin', {"__this__": this});
  
  
    // handle native call
  
  
    // convert native result to dart side object
    if (__result__ == null) {
      return null;
    } else {
      final __return__ = __result__;
      return __return__;
    }
  }
  
  //endregion
}

extension TXVideoJoiner_Batch on List<TXVideoJoiner> {
  //region getters
  
  //endregion

  //region setters
  
  //endregion

  //region methods
  
  Future<List<TXVideoJoiner>> initWithPreview_batch(List<TXPreviewParam> param) async {
    if (false) {
      return Future.error('all args must have same length!');
    }
  
    // invoke native method
    final resultBatch = await MethodChannel('com.fluttify/tencent_live_fluttify', StandardMethodCodec(FluttifyMessageCodec('tencent_live_fluttify'))).invokeMethod('TXVideoJoiner::initWithPreview_batch', [for (int __i__ = 0; __i__ < this.length; __i__++) {"param": param[__i__], "__this__": this[__i__]}]);
  
  
    // convert native result to dart side object
    if (resultBatch == null) {
      return null;
    } else {
      final typedResult = (resultBatch as List).cast<String>().map((__result__) => TXVideoJoiner()..refId = __result__..tag__ = 'tencent_live_fluttify').toList();
      return typedResult;
    }
  }
  
  
  Future<List<int>> setVideoPathList_batch(List<List<dynamic>> videoPathList) async {
    if (false) {
      return Future.error('all args must have same length!');
    }
  
    // invoke native method
    final resultBatch = await MethodChannel('com.fluttify/tencent_live_fluttify', StandardMethodCodec(FluttifyMessageCodec('tencent_live_fluttify'))).invokeMethod('TXVideoJoiner::setVideoPathList_batch', [for (int __i__ = 0; __i__ < this.length; __i__++) {"videoPathList": videoPathList[__i__], "__this__": this[__i__]}]);
  
  
    // convert native result to dart side object
    if (resultBatch == null) {
      return null;
    } else {
      final typedResult = (resultBatch as List).cast<int>().map((__result__) => __result__).toList();
      return typedResult;
    }
  }
  
  
  Future<List<void>> setVideoVolumes_batch(List<List<num>> volumes) async {
    if (false) {
      return Future.error('all args must have same length!');
    }
  
    // invoke native method
    final resultBatch = await MethodChannel('com.fluttify/tencent_live_fluttify', StandardMethodCodec(FluttifyMessageCodec('tencent_live_fluttify'))).invokeMethod('TXVideoJoiner::setVideoVolumes_batch', [for (int __i__ = 0; __i__ < this.length; __i__++) {"volumes": volumes[__i__], "__this__": this[__i__]}]);
  
  
    // convert native result to dart side object
    if (resultBatch == null) {
      return null;
    } else {
      final typedResult = (resultBatch as List).cast<String>().map((__result__) => __result__).toList();
      return typedResult;
    }
  }
  
  
  Future<List<void>> startPlay_batch() async {
    if (false) {
      return Future.error('all args must have same length!');
    }
  
    // invoke native method
    final resultBatch = await MethodChannel('com.fluttify/tencent_live_fluttify', StandardMethodCodec(FluttifyMessageCodec('tencent_live_fluttify'))).invokeMethod('TXVideoJoiner::startPlay_batch', [for (int __i__ = 0; __i__ < this.length; __i__++) {"__this__": this[__i__]}]);
  
  
    // convert native result to dart side object
    if (resultBatch == null) {
      return null;
    } else {
      final typedResult = (resultBatch as List).cast<String>().map((__result__) => __result__).toList();
      return typedResult;
    }
  }
  
  
  Future<List<void>> pausePlay_batch() async {
    if (false) {
      return Future.error('all args must have same length!');
    }
  
    // invoke native method
    final resultBatch = await MethodChannel('com.fluttify/tencent_live_fluttify', StandardMethodCodec(FluttifyMessageCodec('tencent_live_fluttify'))).invokeMethod('TXVideoJoiner::pausePlay_batch', [for (int __i__ = 0; __i__ < this.length; __i__++) {"__this__": this[__i__]}]);
  
  
    // convert native result to dart side object
    if (resultBatch == null) {
      return null;
    } else {
      final typedResult = (resultBatch as List).cast<String>().map((__result__) => __result__).toList();
      return typedResult;
    }
  }
  
  
  Future<List<void>> resumePlay_batch() async {
    if (false) {
      return Future.error('all args must have same length!');
    }
  
    // invoke native method
    final resultBatch = await MethodChannel('com.fluttify/tencent_live_fluttify', StandardMethodCodec(FluttifyMessageCodec('tencent_live_fluttify'))).invokeMethod('TXVideoJoiner::resumePlay_batch', [for (int __i__ = 0; __i__ < this.length; __i__++) {"__this__": this[__i__]}]);
  
  
    // convert native result to dart side object
    if (resultBatch == null) {
      return null;
    } else {
      final typedResult = (resultBatch as List).cast<String>().map((__result__) => __result__).toList();
      return typedResult;
    }
  }
  
  
  Future<List<void>> stopPlay_batch() async {
    if (false) {
      return Future.error('all args must have same length!');
    }
  
    // invoke native method
    final resultBatch = await MethodChannel('com.fluttify/tencent_live_fluttify', StandardMethodCodec(FluttifyMessageCodec('tencent_live_fluttify'))).invokeMethod('TXVideoJoiner::stopPlay_batch', [for (int __i__ = 0; __i__ < this.length; __i__++) {"__this__": this[__i__]}]);
  
  
    // convert native result to dart side object
    if (resultBatch == null) {
      return null;
    } else {
      final typedResult = (resultBatch as List).cast<String>().map((__result__) => __result__).toList();
      return typedResult;
    }
  }
  
  
  Future<List<void>> joinVideo_videoOutputPath_batch(List<TXVideoCompressed> videoCompressed, List<String> videoOutputPath) async {
    if (videoCompressed.length != videoOutputPath.length) {
      return Future.error('all args must have same length!');
    }
  
    // invoke native method
    final resultBatch = await MethodChannel('com.fluttify/tencent_live_fluttify', StandardMethodCodec(FluttifyMessageCodec('tencent_live_fluttify'))).invokeMethod('TXVideoJoiner::joinVideo_videoOutputPath_batch', [for (int __i__ = 0; __i__ < this.length; __i__++) {"videoCompressed": videoCompressed[__i__].toValue(), "videoOutputPath": videoOutputPath[__i__], "__this__": this[__i__]}]);
  
  
    // convert native result to dart side object
    if (resultBatch == null) {
      return null;
    } else {
      final typedResult = (resultBatch as List).cast<String>().map((__result__) => __result__).toList();
      return typedResult;
    }
  }
  
  
  Future<List<void>> splitJoinVideo_videoOutputPath_batch(List<TXVideoCompressed> videoCompressed, List<String> videoOutputPath) async {
    if (videoCompressed.length != videoOutputPath.length) {
      return Future.error('all args must have same length!');
    }
  
    // invoke native method
    final resultBatch = await MethodChannel('com.fluttify/tencent_live_fluttify', StandardMethodCodec(FluttifyMessageCodec('tencent_live_fluttify'))).invokeMethod('TXVideoJoiner::splitJoinVideo_videoOutputPath_batch', [for (int __i__ = 0; __i__ < this.length; __i__++) {"videoCompressed": videoCompressed[__i__].toValue(), "videoOutputPath": videoOutputPath[__i__], "__this__": this[__i__]}]);
  
  
    // convert native result to dart side object
    if (resultBatch == null) {
      return null;
    } else {
      final typedResult = (resultBatch as List).cast<String>().map((__result__) => __result__).toList();
      return typedResult;
    }
  }
  
  
  Future<List<void>> cancelJoin_batch() async {
    if (false) {
      return Future.error('all args must have same length!');
    }
  
    // invoke native method
    final resultBatch = await MethodChannel('com.fluttify/tencent_live_fluttify', StandardMethodCodec(FluttifyMessageCodec('tencent_live_fluttify'))).invokeMethod('TXVideoJoiner::cancelJoin_batch', [for (int __i__ = 0; __i__ < this.length; __i__++) {"__this__": this[__i__]}]);
  
  
    // convert native result to dart side object
    if (resultBatch == null) {
      return null;
    } else {
      final typedResult = (resultBatch as List).cast<String>().map((__result__) => __result__).toList();
      return typedResult;
    }
  }
  
  //endregion
}