// 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 TXVideoInfoReader extends NSObject  {
  //region constants
  static const String name__ = 'TXVideoInfoReader';

  
  //endregion

  //region creators
  static Future<TXVideoInfoReader> create__({ bool init = true /* ios only */ }) async {
    final refId = await MethodChannel('com.fluttify/tencent_live_fluttify', StandardMethodCodec(FluttifyMessageCodec('tencent_live_fluttify'))).invokeMethod('ObjectFactory::createTXVideoInfoReader', {'init': init});
    final object = TXVideoInfoReader()..refId = refId..tag__ = 'tencent_live_fluttify';
    return object;
  }
  
  static Future<List<TXVideoInfoReader>> 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_batchTXVideoInfoReader', {'length': length, 'init': init});
  
    final List<TXVideoInfoReader> typedResult = resultBatch.map((result) => TXVideoInfoReader()..refId = result..tag__ = 'tencent_live_fluttify').toList();
    return typedResult;
  }
  
  //endregion

  //region getters
  
  //endregion

  //region setters
  
  //endregion

  //region methods
  
  static Future<TXVideoInfo> getVideoInfo(String videoPath) async {
    // print log
    if (fluttifyLogEnabled) {
      debugPrint('fluttify-dart: TXVideoInfoReader::getVideoInfo([\'videoPath\':$videoPath])');
    }
  
    // invoke native method
    final __result__ = await MethodChannel('com.fluttify/tencent_live_fluttify', StandardMethodCodec(FluttifyMessageCodec('tencent_live_fluttify'))).invokeMethod('TXVideoInfoReader::getVideoInfo', {"videoPath": videoPath});
  
  
    // handle native call
  
  
    // convert native result to dart side object
    if (__result__ == null) {
      return null;
    } else {
      final __return__ = TXVideoInfo()..refId = __result__..tag__ = 'tencent_live_fluttify';
      return __return__;
    }
  }
  
  
  static Future<void> getSampleImages_videoPath_progress(int count, String videoPath, bool sampleProcess(int number, UIImage image)) async {
    // print log
    if (fluttifyLogEnabled) {
      debugPrint('fluttify-dart: TXVideoInfoReader::getSampleImages([\'count\':$count, \'videoPath\':$videoPath])');
    }
  
    // invoke native method
    final __result__ = await MethodChannel('com.fluttify/tencent_live_fluttify', StandardMethodCodec(FluttifyMessageCodec('tencent_live_fluttify'))).invokeMethod('TXVideoInfoReader::getSampleImages_videoPath_progress', {"count": count, "videoPath": videoPath});
  
  
    // handle native call
    MethodChannel('sampleProcess::Callback', StandardMethodCodec(FluttifyMessageCodec('tencent_live_fluttify')))
        .setMethodCallHandler((methodCall) async {
          try {
            final args = methodCall.arguments as Map;
            switch (methodCall.method) {
              case 'Callback::sampleProcess::sampleProcess':
                // print log
                if (fluttifyLogEnabled) {
          
                }
          
                // handle the native call
                if (sampleProcess != null) sampleProcess(args['number'], TypeOpTencentLiveFluttifyIOS((args['image'] as Object))?.as__<UIImage>());
                break;
              default:
                break;
            }
          } catch (e) {
            debugPrint(e);
            throw e;
          }
        });
  
    // convert native result to dart side object
    if (__result__ == null) {
      return null;
    } else {
      final __return__ = __result__;
      return __return__;
    }
  }
  
  
  static Future<UIImage> getSampleImage_videoPath(double time, String videoPath) async {
    // print log
    if (fluttifyLogEnabled) {
      debugPrint('fluttify-dart: TXVideoInfoReader::getSampleImage([\'time\':$time, \'videoPath\':$videoPath])');
    }
  
    // invoke native method
    final __result__ = await MethodChannel('com.fluttify/tencent_live_fluttify', StandardMethodCodec(FluttifyMessageCodec('tencent_live_fluttify'))).invokeMethod('TXVideoInfoReader::getSampleImage_videoPath', {"time": time, "videoPath": videoPath});
  
  
    // handle native call
  
  
    // convert native result to dart side object
    if (__result__ == null) {
      return null;
    } else {
      final __return__ = UIImage()..refId = __result__..tag__ = 'tencent_live_fluttify';
      return __return__;
    }
  }
  
  //endregion
}

extension TXVideoInfoReader_Batch on List<TXVideoInfoReader> {
  //region getters
  
  //endregion

  //region setters
  
  //endregion

  //region methods
  
  static Future<List<TXVideoInfo>> getVideoInfo_batch(List<String> videoPath) 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('TXVideoInfoReader::getVideoInfo_batch', [for (int __i__ = 0; __i__ < videoPath.length; __i__++) {"videoPath": videoPath[__i__]}]);
  
  
    // convert native result to dart side object
    if (resultBatch == null) {
      return null;
    } else {
      final typedResult = (resultBatch as List).cast<String>().map((__result__) => TXVideoInfo()..refId = __result__..tag__ = 'tencent_live_fluttify').toList();
      return typedResult;
    }
  }
  
  
  static Future<List<UIImage>> getSampleImage_videoPath_batch(List<double> time, List<String> videoPath) async {
    if (time.length != videoPath.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('TXVideoInfoReader::getSampleImage_videoPath_batch', [for (int __i__ = 0; __i__ < time.length; __i__++) {"time": time[__i__], "videoPath": videoPath[__i__]}]);
  
  
    // convert native result to dart side object
    if (resultBatch == null) {
      return null;
    } else {
      final typedResult = (resultBatch as List).cast<String>().map((__result__) => UIImage()..refId = __result__..tag__ = 'tencent_live_fluttify').toList();
      return typedResult;
    }
  }
  
  //endregion
}