#include <RemoteDataComponent/RemoteDataComponent.hpp>

RemoteDataComponent::RemoteDataComponent(Controller *ctrl, std::function<DataCableComponent&()> componentGetter) :
    getDataComponent(componentGetter),
    addInputRule(ctrl, Controller::RunsOn::Server,
        [this](DataCableComponent::InputRule rule) -> uint32_t
        {
            getDataComponent().addInputRule(rule);
            return 0;
        }
    ),
    removeInputRule(ctrl, Controller::RunsOn::Server,
        [this](uint32_t index) -> uint32_t
        {
            getDataComponent().removeInputRule(index);
            return 0;
        }
    ),
    setInputRuleChannel(ctrl, Controller::RunsOn::Server,
        [this](uint32_t index, DataLink::Channel channel) -> uint32_t
        {
            getDataComponent().setInputRuleChannel(index, channel);
            return 0;
        }
    ),
    setInputRuleDestState(ctrl, Controller::RunsOn::Server,
        [this](uint32_t index, bool destState) -> uint32_t
        {
            getDataComponent().setInputRuleDestState(index, destState);
            return 0;
        }
    ),
    setInputRuleVerb(ctrl, Controller::RunsOn::Server,
        [this](uint32_t index, std::string verb) -> uint32_t
        {
            getDataComponent().setInputRuleVerb(index, verb);
            return 0;
        }
    )
{}