///
/// HybridOneSpeechSpec.hpp
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
/// https://github.com/mrousavy/nitro
/// Copyright © Marc Rousavy @ Margelo
///

#pragma once

#include <NitroModules/JHybridObject.hpp>
#include <fbjni/fbjni.h>
#include "HybridOneSpeechSpec.hpp"




namespace margelo::nitro::one {

  using namespace facebook;

  class JHybridOneSpeechSpec: public virtual HybridOneSpeechSpec, public virtual JHybridObject {
  public:
    struct JavaPart: public jni::JavaClass<JavaPart, JHybridObject::JavaPart> {
      static constexpr auto kJavaDescriptor = "Lcom/margelo/nitro/one/HybridOneSpeechSpec;";
      std::shared_ptr<JHybridOneSpeechSpec> getJHybridOneSpeechSpec();
    };
    struct CxxPart: public jni::HybridClass<CxxPart, JHybridObject::CxxPart> {
      static constexpr auto kJavaDescriptor = "Lcom/margelo/nitro/one/HybridOneSpeechSpec$CxxPart;";
      static jni::local_ref<jhybriddata> initHybrid(jni::alias_ref<jhybridobject> jThis);
      static void registerNatives();
      using HybridBase::HybridBase;
    protected:
      std::shared_ptr<JHybridObject> createHybridObject(const jni::local_ref<JHybridObject::JavaPart>& javaPart) override;
    };

  public:
    explicit JHybridOneSpeechSpec(const jni::local_ref<JHybridOneSpeechSpec::JavaPart>& javaPart):
      HybridObject(HybridOneSpeechSpec::TAG),
      JHybridObject(javaPart),
      _javaPart(jni::make_global(javaPart)) {}
    ~JHybridOneSpeechSpec() override {
      // Hermes GC can destroy JS objects on a non-JNI Thread.
      jni::ThreadScope::WithClassLoader([&] { _javaPart.reset(); });
    }

  public:
    inline const jni::global_ref<JHybridOneSpeechSpec::JavaPart>& getJavaPart() const noexcept {
      return _javaPart;
    }

  public:
    // Properties
    

  public:
    // Methods
    bool isAvailable() override;
    std::shared_ptr<Promise<SpeechPermissionResponse>> getPermissions() override;
    std::shared_ptr<Promise<SpeechPermissionResponse>> requestPermissions() override;
    void start(const SpeechStartOptions& options, const std::function<void(const SpeechEvent& /* event */)>& onEvent) override;
    void stop() override;
    void abort() override;

  private:
    jni::global_ref<JHybridOneSpeechSpec::JavaPart> _javaPart;
  };

} // namespace margelo::nitro::one
