#include "Output.h"
namespace mdd {
    Output::Output( const std::string& type, int appendix, const json& initial) :
            _changed(false)
    {
        _appendix = appendix;
        _prefix = "";
        _type = type;
        _value = initial;
    }

    const json& Output::getValue() { return _value; }

    json& Output::getValueInternal() {
        _changed = true;
        return _value;
    }

    std::string Output::getType() { return _type; }

    bool Output::hasChanged() { return _changed; }

    void Output::resetChange() { _changed = false; }

    std::string Output::setType(std::string type){
        _type = type;
        return getID();
    }

    std::string Output::getID(){
        return _prefix + "/" + _type + std::to_string(_appendix);
    }

    std::string Output::setPrefix(std::string prefix){
        _prefix = prefix;
        return getID();
    }

    std::string Output::setAppendix(int appendix){
        _appendix = appendix;
        return getID();
    }
}