// 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:amap_map_fluttify/src/ios/ios.export.g.dart';
import 'package:flutter/foundation.dart';
import 'package:flutter/services.dart';

import 'package:foundation_fluttify/foundation_fluttify.dart';
import 'package:core_location_fluttify/core_location_fluttify.dart';
import 'package:amap_core_fluttify/amap_core_fluttify.dart';
import 'package:amap_search_fluttify/amap_search_fluttify.dart';
import 'package:amap_location_fluttify/amap_location_fluttify.dart';

class MAAnimatedAnnotation extends MAPointAnnotation with MAAnimatableAnnotation, MAAnnotation, MAOverlay {
  //region constants
  static const String name__ = 'MAAnimatedAnnotation';

  @override
  final String tag__ = 'amap_map_fluttify';

  
  //endregion

  //region creators
  static Future<MAAnimatedAnnotation> create__({ bool init = true /* ios only */ }) async {
    final __result__ = await kAmapMapFluttifyChannel.invokeMethod(
      'ObjectFactory::createMAAnimatedAnnotation',
      {'init': init}
    );
    return AmapMapFluttifyIOSAs<MAAnimatedAnnotation>(__result__)!;
  }
  
  static Future<List<MAAnimatedAnnotation>> create_batch__(int length, { bool init = true /* ios only */ }) async {
    assert(true);
    final __result_batch__ = await  kAmapMapFluttifyChannel.invokeListMethod(
      'ObjectFactory::create_batchMAAnimatedAnnotation',
      {'length': length, 'init': init}
    );
    return __result_batch__
        ?.map((it) => AmapMapFluttifyIOSAs<MAAnimatedAnnotation>(it))
        .where((element) => element !=null)
        .cast<MAAnimatedAnnotation>()
        .toList() ?? <MAAnimatedAnnotation>[];
  }
  
  //endregion

  //region getters
  Future<double?> get_movingDirection() async {
    final __result__ = await kAmapMapFluttifyChannel.invokeMethod("MAAnimatedAnnotation::get_movingDirection", {'__this__': this});
    return __result__;
  }
  
  //endregion

  //region setters
  Future<void> set_movingDirection(double? movingDirection) async {
    await kAmapMapFluttifyChannel.invokeMethod('MAAnimatedAnnotation::set_movingDirection', <String, dynamic>{'__this__': this, "movingDirection": movingDirection});
  }
  
  //endregion

  //region methods
  
  Future<MAAnnotationMoveAnimation?> addMoveAnimationWithKeyCoordinates_count_withDuration_withName_completeCallback(List<CLLocationCoordinate2D>? coordinates, int? count, double? duration, String? name, void Function(bool? isFinished) completeCallback) async {
    // print log
    if (fluttifyLogEnabled) {
      debugPrint('fluttify-dart: MAAnimatedAnnotation@$refId::addMoveAnimationWithKeyCoordinates([\'count\':$count, \'duration\':$duration, \'name\':$name])');
    }
  
    // invoke native method
    final __result__ = await kAmapMapFluttifyChannel.invokeMethod('MAAnimatedAnnotation::addMoveAnimationWithKeyCoordinates_count_withDuration_withName_completeCallback', {"coordinates": coordinates, "count": count, "duration": duration, "name": name, "__this__": this});
  
  
    // handle native call
    MethodChannel('void|BOOL#isFinished::Callback@$refId', kAmapMapFluttifyMethodCodec)
        .setMethodCallHandler((methodCall) async {
          try {
            final args = methodCall.arguments as Map;
            switch (methodCall.method) {
              case 'void|BOOL#isFinished':
                // print log
                if (fluttifyLogEnabled) {
                  debugPrint('fluttify-dart-callback: completeCallback([\'isFinished\':${args['isFinished']}])');
                }
          
                // handle the native call
                completeCallback(args['isFinished']);
                break;
              default:
                throw MissingPluginException('方法${methodCall.method}未实现');
                break;
            }
          } catch (e) {
            debugPrint(e.toString());
            rethrow;
          }
        });
  
    return AmapMapFluttifyIOSAs<MAAnnotationMoveAnimation>(__result__);
  }
  
  
  Future<MAAnnotationMoveAnimation?> addMoveAnimationWithKeyCoordinates_count_withDuration_withName_completeCallback_stepCallback(List<CLLocationCoordinate2D>? coordinates, int? count, double? duration, String? name, void Function(bool? isFinished) completeCallback, void Function(MAAnnotationMoveAnimation? currentAni) stepCallback) async {
    // print log
    if (fluttifyLogEnabled) {
      debugPrint('fluttify-dart: MAAnimatedAnnotation@$refId::addMoveAnimationWithKeyCoordinates([\'count\':$count, \'duration\':$duration, \'name\':$name])');
    }
  
    // invoke native method
    final __result__ = await kAmapMapFluttifyChannel.invokeMethod('MAAnimatedAnnotation::addMoveAnimationWithKeyCoordinates_count_withDuration_withName_completeCallback_stepCallback', {"coordinates": coordinates, "count": count, "duration": duration, "name": name, "__this__": this});
  
  
    // handle native call
    MethodChannel('void|BOOL#isFinished::Callback@$refId', kAmapMapFluttifyMethodCodec)
        .setMethodCallHandler((methodCall) async {
          try {
            final args = methodCall.arguments as Map;
            switch (methodCall.method) {
              case 'void|BOOL#isFinished':
                // print log
                if (fluttifyLogEnabled) {
                  debugPrint('fluttify-dart-callback: completeCallback([\'isFinished\':${args['isFinished']}])');
                }
          
                // handle the native call
                completeCallback(args['isFinished']);
                break;
              default:
                throw MissingPluginException('方法${methodCall.method}未实现');
                break;
            }
          } catch (e) {
            debugPrint(e.toString());
            rethrow;
          }
        });
    MethodChannel('void|MAAnnotationMoveAnimation*#currentAni::Callback@$refId', kAmapMapFluttifyMethodCodec)
        .setMethodCallHandler((methodCall) async {
          try {
            final args = methodCall.arguments as Map;
            switch (methodCall.method) {
              case 'void|MAAnnotationMoveAnimation*#currentAni':
                // print log
                if (fluttifyLogEnabled) {
                  debugPrint('fluttify-dart-callback: stepCallback([\'currentAni\':${args['currentAni']}])');
                }
          
                // handle the native call
                stepCallback(AmapMapFluttifyIOSAs<MAAnnotationMoveAnimation>(args['currentAni']));
                break;
              default:
                throw MissingPluginException('方法${methodCall.method}未实现');
                break;
            }
          } catch (e) {
            debugPrint(e.toString());
            rethrow;
          }
        });
  
    return AmapMapFluttifyIOSAs<MAAnnotationMoveAnimation>(__result__);
  }
  
  
  Future<List<MAAnnotationMoveAnimation>?> allMoveAnimations() async {
    // print log
    if (fluttifyLogEnabled) {
      debugPrint('fluttify-dart: MAAnimatedAnnotation@$refId::allMoveAnimations([])');
    }
  
    // invoke native method
    final __result__ = await kAmapMapFluttifyChannel.invokeMethod('MAAnimatedAnnotation::allMoveAnimations', {"__this__": this});
  
  
    // handle native call
  
  
    return (__result__ as List?)?.map((it) => AmapMapFluttifyIOSAs<MAAnnotationMoveAnimation>(it)).where((e) => e != null).cast<MAAnnotationMoveAnimation>().toList();
  }
  
  
  Future<void> setNeedsStart() async {
    // print log
    if (fluttifyLogEnabled) {
      debugPrint('fluttify-dart: MAAnimatedAnnotation@$refId::setNeedsStart([])');
    }
  
    // invoke native method
    final __result__ = await kAmapMapFluttifyChannel.invokeMethod('MAAnimatedAnnotation::setNeedsStart', {"__this__": this});
  
  
    // handle native call
  
  
    return __result__;
  }
  
  //endregion

  @override
  String toString() {
    return 'MAAnimatedAnnotation{refId: $refId, runtimeType: $runtimeType, tag__: $tag__}';
  }
}

extension MAAnimatedAnnotation_Batch on List<MAAnimatedAnnotation?> {
  String? get refId {
    if (isEmpty) return null;
    return first?.refId;
  }

  //region getters
  Future<List<double?>> get_movingDirection_batch() async {
    final resultBatch = await kAmapMapFluttifyChannel.invokeMethod("MAAnimatedAnnotation::get_movingDirection_batch", [for (final __item__ in this) {'__this__': __item__}]);
    return (resultBatch as List).map((__result__) => __result__).cast<double?>().toList();
  }
  
  //endregion

  //region setters
  Future<void> set_movingDirection_batch(List<double?> movingDirection) async {
    await kAmapMapFluttifyChannel.invokeMethod('MAAnimatedAnnotation::set_movingDirection_batch', [for (int __i__ = 0; __i__ < this.length; __i__++) {'__this__': this[__i__], "movingDirection": movingDirection[__i__]}]);
  
  
  }
  
  //endregion

  //region methods
  
  Future<List<List<MAAnnotationMoveAnimation>?>> allMoveAnimations_batch() async {
    assert(true);
  
    // invoke native method
    final resultBatch = await kAmapMapFluttifyChannel.invokeMethod('MAAnimatedAnnotation::allMoveAnimations_batch', [for (int __i__ = 0; __i__ < this.length; __i__++) {"__this__": this[__i__]}]);
  
  
    return (resultBatch as List).map((__result__) => (__result__ as List?)?.map((it) => AmapMapFluttifyIOSAs<MAAnnotationMoveAnimation>(it)).where((e) => e != null).cast<MAAnnotationMoveAnimation>().toList()).cast<List<MAAnnotationMoveAnimation>?>().toList();
  }
  
  
  Future<List<void>> setNeedsStart_batch() async {
    assert(true);
  
    // invoke native method
    final resultBatch = await kAmapMapFluttifyChannel.invokeMethod('MAAnimatedAnnotation::setNeedsStart_batch', [for (int __i__ = 0; __i__ < this.length; __i__++) {"__this__": this[__i__]}]);
  
  
    return (resultBatch as List).map((__result__) => __result__).cast<void>().toList();
  }
  
  //endregion
}