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

#pragma once

#if __has_include(<NitroModules/HybridObject.hpp>)
#include <NitroModules/HybridObject.hpp>
#else
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
#endif

// Forward declaration of `STTLoadOptions` to properly resolve imports.
namespace margelo::nitro::mlxreactnative { struct STTLoadOptions; }

#include <string>
#include <NitroModules/Promise.hpp>
#include "STTLoadOptions.hpp"
#include <optional>
#include <NitroModules/ArrayBuffer.hpp>
#include <functional>

namespace margelo::nitro::mlxreactnative {

  using namespace margelo::nitro;

  /**
   * An abstract base class for `STT`
   * Inherit this class to create instances of `HybridSTTSpec` in C++.
   * You must explicitly call `HybridObject`'s constructor yourself, because it is virtual.
   * @example
   * ```cpp
   * class HybridSTT: public HybridSTTSpec {
   * public:
   *   HybridSTT(...): HybridObject(TAG) { ... }
   *   // ...
   * };
   * ```
   */
  class HybridSTTSpec: public virtual HybridObject {
    public:
      // Constructor
      explicit HybridSTTSpec(): HybridObject(TAG) { }

      // Destructor
      ~HybridSTTSpec() override = default;

    public:
      // Properties
      virtual bool getIsLoaded() = 0;
      virtual bool getIsTranscribing() = 0;
      virtual bool getIsListening() = 0;
      virtual std::string getModelId() = 0;

    public:
      // Methods
      virtual std::shared_ptr<Promise<void>> load(const std::string& modelId, const std::optional<STTLoadOptions>& options) = 0;
      virtual std::shared_ptr<Promise<std::string>> transcribe(const std::shared_ptr<ArrayBuffer>& audio) = 0;
      virtual std::shared_ptr<Promise<std::string>> transcribeStream(const std::shared_ptr<ArrayBuffer>& audio, const std::function<void(const std::string& /* token */)>& onToken) = 0;
      virtual std::shared_ptr<Promise<void>> startListening() = 0;
      virtual std::shared_ptr<Promise<std::string>> transcribeBuffer() = 0;
      virtual std::shared_ptr<Promise<std::string>> stopListening() = 0;
      virtual void stop() = 0;
      virtual void unload() = 0;

    protected:
      // Hybrid Setup
      void loadHybridMethods() override;

    protected:
      // Tag for logging
      static constexpr auto TAG = "STT";
  };

} // namespace margelo::nitro::mlxreactnative
