/**
 * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
 *
 * Do not edit this file as changes may cause incorrect behavior and will be lost
 * once the code is regenerated.
 *
 * @generated by codegen project: GenerateModuleObjCpp
 *
 * We create an umbrella header (and corresponding implementation) here since
 * Cxx compilation in BUCK has a limitation: source-code producing genrule()s
 * must have a single output. More files => more genrule()s => slower builds.
 */

#import "RNSpeechSpec.h"


@implementation NativeSpeechSpecBase
- (void)emitOnError:(NSDictionary *)value
{
  _eventEmitterCallback("onError", value);
}
- (void)emitOnStart:(NSDictionary *)value
{
  _eventEmitterCallback("onStart", value);
}
- (void)emitOnFinish:(NSDictionary *)value
{
  _eventEmitterCallback("onFinish", value);
}
- (void)emitOnPause:(NSDictionary *)value
{
  _eventEmitterCallback("onPause", value);
}
- (void)emitOnResume:(NSDictionary *)value
{
  _eventEmitterCallback("onResume", value);
}
- (void)emitOnStopped:(NSDictionary *)value
{
  _eventEmitterCallback("onStopped", value);
}
- (void)emitOnProgress:(NSDictionary *)value
{
  _eventEmitterCallback("onProgress", value);
}

- (void)setEventEmitterCallback:(EventEmitterCallbackWrapper *)eventEmitterCallbackWrapper
{
  _eventEmitterCallback = std::move(eventEmitterCallbackWrapper->_eventEmitterCallback);
}
@end

@implementation RCTCxxConvert (NativeSpeech_VoiceOptions)
+ (RCTManagedPointer *)JS_NativeSpeech_VoiceOptions:(id)json
{
  return facebook::react::managedPointer<JS::NativeSpeech::VoiceOptions>(json);
}
@end
namespace facebook::react {
  
    static facebook::jsi::Value __hostFunction_NativeSpeechSpecJSI_reset(facebook::jsi::Runtime& rt, TurboModule &turboModule, const facebook::jsi::Value* args, size_t count) {
      return static_cast<ObjCTurboModule&>(turboModule).invokeObjCMethod(rt, VoidKind, "reset", @selector(reset), args, count);
    }

    static facebook::jsi::Value __hostFunction_NativeSpeechSpecJSI_stop(facebook::jsi::Runtime& rt, TurboModule &turboModule, const facebook::jsi::Value* args, size_t count) {
      return static_cast<ObjCTurboModule&>(turboModule).invokeObjCMethod(rt, PromiseKind, "stop", @selector(stop:reject:), args, count);
    }

    static facebook::jsi::Value __hostFunction_NativeSpeechSpecJSI_pause(facebook::jsi::Runtime& rt, TurboModule &turboModule, const facebook::jsi::Value* args, size_t count) {
      return static_cast<ObjCTurboModule&>(turboModule).invokeObjCMethod(rt, PromiseKind, "pause", @selector(pause:reject:), args, count);
    }

    static facebook::jsi::Value __hostFunction_NativeSpeechSpecJSI_resume(facebook::jsi::Runtime& rt, TurboModule &turboModule, const facebook::jsi::Value* args, size_t count) {
      return static_cast<ObjCTurboModule&>(turboModule).invokeObjCMethod(rt, PromiseKind, "resume", @selector(resume:reject:), args, count);
    }

    static facebook::jsi::Value __hostFunction_NativeSpeechSpecJSI_isSpeaking(facebook::jsi::Runtime& rt, TurboModule &turboModule, const facebook::jsi::Value* args, size_t count) {
      return static_cast<ObjCTurboModule&>(turboModule).invokeObjCMethod(rt, PromiseKind, "isSpeaking", @selector(isSpeaking:reject:), args, count);
    }

    static facebook::jsi::Value __hostFunction_NativeSpeechSpecJSI_speak(facebook::jsi::Runtime& rt, TurboModule &turboModule, const facebook::jsi::Value* args, size_t count) {
      return static_cast<ObjCTurboModule&>(turboModule).invokeObjCMethod(rt, PromiseKind, "speak", @selector(speak:resolve:reject:), args, count);
    }

    static facebook::jsi::Value __hostFunction_NativeSpeechSpecJSI_initialize(facebook::jsi::Runtime& rt, TurboModule &turboModule, const facebook::jsi::Value* args, size_t count) {
      return static_cast<ObjCTurboModule&>(turboModule).invokeObjCMethod(rt, VoidKind, "initialize", @selector(initialize:), args, count);
    }

    static facebook::jsi::Value __hostFunction_NativeSpeechSpecJSI_getAvailableVoices(facebook::jsi::Runtime& rt, TurboModule &turboModule, const facebook::jsi::Value* args, size_t count) {
      return static_cast<ObjCTurboModule&>(turboModule).invokeObjCMethod(rt, PromiseKind, "getAvailableVoices", @selector(getAvailableVoices:resolve:reject:), args, count);
    }

    static facebook::jsi::Value __hostFunction_NativeSpeechSpecJSI_speakWithOptions(facebook::jsi::Runtime& rt, TurboModule &turboModule, const facebook::jsi::Value* args, size_t count) {
      return static_cast<ObjCTurboModule&>(turboModule).invokeObjCMethod(rt, PromiseKind, "speakWithOptions", @selector(speakWithOptions:options:resolve:reject:), args, count);
    }

  NativeSpeechSpecJSI::NativeSpeechSpecJSI(const ObjCTurboModule::InitParams &params)
    : ObjCTurboModule(params) {
      
        methodMap_["reset"] = MethodMetadata {0, __hostFunction_NativeSpeechSpecJSI_reset};
        
        
        methodMap_["stop"] = MethodMetadata {0, __hostFunction_NativeSpeechSpecJSI_stop};
        
        
        methodMap_["pause"] = MethodMetadata {0, __hostFunction_NativeSpeechSpecJSI_pause};
        
        
        methodMap_["resume"] = MethodMetadata {0, __hostFunction_NativeSpeechSpecJSI_resume};
        
        
        methodMap_["isSpeaking"] = MethodMetadata {0, __hostFunction_NativeSpeechSpecJSI_isSpeaking};
        
        
        methodMap_["speak"] = MethodMetadata {1, __hostFunction_NativeSpeechSpecJSI_speak};
        
        
        methodMap_["initialize"] = MethodMetadata {1, __hostFunction_NativeSpeechSpecJSI_initialize};
        setMethodArgConversionSelector(@"initialize", 0, @"JS_NativeSpeech_VoiceOptions:");
        
        methodMap_["getAvailableVoices"] = MethodMetadata {1, __hostFunction_NativeSpeechSpecJSI_getAvailableVoices};
        
        
        methodMap_["speakWithOptions"] = MethodMetadata {2, __hostFunction_NativeSpeechSpecJSI_speakWithOptions};
        setMethodArgConversionSelector(@"speakWithOptions", 1, @"JS_NativeSpeech_VoiceOptions:");
        eventEmitterMap_["onError"] = std::make_shared<AsyncEventEmitter<id>>();
        eventEmitterMap_["onStart"] = std::make_shared<AsyncEventEmitter<id>>();
        eventEmitterMap_["onFinish"] = std::make_shared<AsyncEventEmitter<id>>();
        eventEmitterMap_["onPause"] = std::make_shared<AsyncEventEmitter<id>>();
        eventEmitterMap_["onResume"] = std::make_shared<AsyncEventEmitter<id>>();
        eventEmitterMap_["onStopped"] = std::make_shared<AsyncEventEmitter<id>>();
        eventEmitterMap_["onProgress"] = std::make_shared<AsyncEventEmitter<id>>();
        setEventEmitterCallback([&](const std::string &name, id value) {
          static_cast<AsyncEventEmitter<id> &>(*eventEmitterMap_[name]).emit(value);
        });
  }
} // namespace facebook::react
