#pragma once

#include <functional>
#include <string>
#include <string_view>
#include <unordered_map>

#include "application/actions/CommandContext.h"

namespace ta::application
{
    class UiActionDispatcher final
    {
    public:
        using Handler = std::function<void(const CommandContext&)>;

        void bind(std::string action_key, Handler handler);
        [[nodiscard]] bool dispatch(std::string_view action_key, const CommandContext& context) const;

    private:
        std::unordered_map<std::string, Handler> handlers_;
    };
}
