#include "features/chams/ChamsFeature.h"

namespace ta::features::chams
{
    void ChamsFeature::initialize()
    {
        settings_cache_.refresh(settings_);
    }

    void ChamsFeature::on_application_tick()
    {
        const ChamsSettings next = settings_.read();
        settings_cache_.publish_if_changed(next);
        gateway_.application_tick(next);
    }

    void ChamsFeature::on_game_tick()
    {
        gateway_.game_tick(current_settings());
    }

    void ChamsFeature::reset_session() noexcept
    {
        gateway_.reset_session();
    }

    ChamsSettings ChamsFeature::current_settings() const
    {
        return settings_cache_.current_or_default();
    }
}
