#include "Parameter.h"

namespace mdd {
    Parameter::Parameter()
        : ModuleBase(R"JSON(
        {
        "configure":{},
        "GUI":{
            "name":{"value":"Parameter"},
            "color":{"value":"#b91203"}
        }
        })JSON")
    {
        inputs.push_back(std::make_shared<Input>("Value",0));
        outputs.push_back(std::make_shared<Output>("Value",0));
        
        key = "Parameter";
        setName(key);
    }

    state Parameter::update() {
        return getOutput(0)->setValue(getInput(0)->getValue());
    }

    std::string Parameter::setName(const std::string& name) {
        _base_config["GUI"]["name"]["value"] = name;
        inputs[0]->setName(name);
        outputs[0]->setName(name);
        return name;
    }

    std::string Parameter::setKey(const std::string& type) {
        key = type;
        return key;
    }

    std::string Parameter::setAppendix(int appendix)
    {
        inputs[0]->setAppendix(appendix);
        outputs[0]->setAppendix(appendix);
        return ModuleBase::setAppendix(appendix);
    }

    bool Parameter::configureChild(const json& config)
    {
        return true;
    }
}