//
//  OnnxMLSinkNode.hpp
//  SwitchboardOnnx
//
//  Created by Tom Dodds on 24/04/2024.
//

#pragma once

#include <switchboard_onnx/export.h>
#include "ModelInstance.h"
#include <switchboard_core/SingleBusAudioSinkNode.hpp>

#include <map>

namespace switchboard::extensions::onnx {

/**
 *  OnnxMLSinkNode class.
 *  @brief Run inference on the incoming audio using an Onnx model for audio-in data-out use-case
 */
class SWITCHBOARDONNX_EXPORT OnnxMLSinkNode : public SingleBusAudioSinkNode {
protected:
    /**
     *  @brief Creates a OnnxMLSinkNode instance.
     */
    OnnxMLSinkNode();

    /**
     * @brief Creates a OnnxMLSinkNode instance.
     *
     * @param config Configuration map for the node.
     */
    explicit OnnxMLSinkNode(const SBAnyMap& config) {};

    /**
     * OnnxMLSinkNode destructor.
     */
    ~OnnxMLSinkNode() override;

    /**
     *  @brief Must be overridden to provide ML prediction on audioBuffer input
     *
     *  @param audioBuffer Input AudioBuffer
     */
    virtual void predict(AudioBuffer<float>& audioBuffer) = 0;
};

}
