///
/// HybridTTSSpec.hpp
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
/// https://github.com/mrousavy/nitro
/// Copyright © 2026 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 `TTSLoadOptions` to properly resolve imports.
namespace margelo::nitro::mlxreactnative { struct TTSLoadOptions; }
// Forward declaration of `TTSGenerateOptions` to properly resolve imports.
namespace margelo::nitro::mlxreactnative { struct TTSGenerateOptions; }

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

namespace margelo::nitro::mlxreactnative {

  using namespace margelo::nitro;

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

      // Destructor
      ~HybridTTSSpec() override = default;

    public:
      // Properties
      virtual bool getIsLoaded() = 0;
      virtual bool getIsGenerating() = 0;
      virtual std::string getModelId() = 0;
      virtual double getSampleRate() = 0;

    public:
      // Methods
      virtual std::shared_ptr<Promise<void>> load(const std::string& modelId, const std::optional<TTSLoadOptions>& options) = 0;
      virtual std::shared_ptr<Promise<std::shared_ptr<ArrayBuffer>>> generate(const std::string& text, const std::optional<TTSGenerateOptions>& options) = 0;
      virtual std::shared_ptr<Promise<void>> stream(const std::string& text, const std::function<void(const std::shared_ptr<ArrayBuffer>& /* audio */)>& onAudioChunk, const std::optional<TTSGenerateOptions>& options) = 0;
      virtual void stop() = 0;
      virtual void unload() = 0;

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

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

} // namespace margelo::nitro::mlxreactnative
