#include "bootstrap/modules/PlayerModule.h"

namespace ta::bootstrap::modules
{
    PlayerModule::PlayerModule(ta::adapters::eft::runtime::EftGameContext& context,
                               ta::application::UiActionDispatcher& actions)
        : gateway_(context), feature_(gateway_, settings_, input_),
          ports_(ModulePorts::bind(feature_, &settings_,
                                   "runtime.application.tick.player",
                                   "runtime.game.tick.player",
                                   "runtime.raid.reset.player"))
    {
        actions.bind("player.add_exp", [this](const ta::application::CommandContext& command)
        {
            feature_.submit(settings_.make_add_exp_command(command.trace_id));
        });
        actions.bind("player.add_fence_rep", [this](const ta::application::CommandContext& command)
        {
            feature_.submit(settings_.make_add_fence_rep_command(command.trace_id));
        });
        actions.bind("player.add_trader_rep", [this](const ta::application::CommandContext& command)
        {
            feature_.submit(settings_.make_add_trader_rep_command(command.trace_id));
        });
        actions.bind("player.set_skill", [this](const ta::application::CommandContext& command)
        {
            feature_.submit(settings_.make_set_skill_command(command.trace_id));
        });
    }
    ta::features::player::PlayerDiagnosticsSnapshot PlayerModule::diagnostics_snapshot() const noexcept
    {
        return feature_.diagnostics_snapshot();
    }
}
