#ifndef MDD_ModuleBase_H
#define MDD_ModuleBase_H

#include "Input.h"
#include "Output.h"
#include "IModule.h"

namespace mdd {

class ModuleBase : public  IModule{
    private:
        std::string _prefix = "";
        std::string _type = "";
        int _appendix = 0;
        std::vector<std::shared_ptr<Input>> _inputs;
        std::vector<std::shared_ptr<Output>> _outputs;

    protected:
        std::shared_ptr<IOutput> getOutput(int handle);
        std::shared_ptr<IInput> getInput(int handle);
        int addInput(const std::string& type, const std::vector<double>& value);
        int addOutput(const std::string& type, const std::vector<double>& initial);

        int pop_backInput();
        int pop_backOutput();

        int clearInput();
        int clearOutput();

        int eraseInput(int index);
        int eraseOutput(int index);

    public:
        std::vector<std::string> getInputs() override;
        std::vector<std::string> getInputIDs() override;
        std::vector<std::string> getOutputs() override;
        std::vector<std::string> getOutputIDs() override;
        std::vector<state> getInputStates() override;
        std::vector<state> getOutputStates() override;
        std::vector<std::shared_ptr<IOutput>> getInputConnections() override;
        std::vector <std::vector <std::shared_ptr<IInput>>> getOutputConnections() override;
        std::vector <std::shared_ptr<IInput>> getOptimizableInputs() override;
        std::vector <std::shared_ptr<IOutput>> getOptimizableOutputs() override;
        std::shared_ptr<IOutput> getOutput(std::string output_id) override;
        std::shared_ptr<IInput> getInput(std::string input_id) override;
        std::string setType(std::string type) override;
        std::string getType() override;
        std::string getID() override;
        std::string setPrefix(std::string prefix) override;
        std::string setAppendix(int appendix) override;
        void updateID() override ;
    };
}
#endif //MDD_BASEMODULE_H
