#pragma once

#include <audioapi/core/types/ChannelCountMode.h>
#include <audioapi/core/types/ChannelInterpretation.h>
#include <audioapi/jsi/JsiHostObject.h>
#include <audioapi/types/NodeOptions.h>

#include <jsi/jsi.h>
#include <memory>

namespace audioapi {
using namespace facebook;

class AudioNode;

class AudioNodeHostObject : public JsiHostObject {
 public:
  explicit AudioNodeHostObject(
      const std::shared_ptr<AudioNode> &node,
      const AudioNodeOptions &options = AudioNodeOptions());
  ~AudioNodeHostObject() override;

  JSI_PROPERTY_GETTER_DECL(numberOfInputs);
  JSI_PROPERTY_GETTER_DECL(numberOfOutputs);
  JSI_PROPERTY_GETTER_DECL(channelCount);
  JSI_PROPERTY_GETTER_DECL(channelCountMode);
  JSI_PROPERTY_GETTER_DECL(channelInterpretation);

  JSI_HOST_FUNCTION_DECL(connect);
  JSI_HOST_FUNCTION_DECL(disconnect);

 protected:
  std::shared_ptr<AudioNode> node_;

  const int numberOfInputs_;
  const int numberOfOutputs_;
  size_t channelCount_;
  const ChannelCountMode channelCountMode_;
  const ChannelInterpretation channelInterpretation_;
};
} // namespace audioapi
