#include "features/esp/EspFeature.h"

namespace ta::features::esp
{
    void EspFeature::initialize()
    {
        settings_cache_.refresh(settings_source_);
    }

    void EspFeature::on_application_tick()
    {
        settings_cache_.refresh(settings_source_);
        gateway_.application_tick();
    }

    void EspFeature::on_game_tick()
    {
        const auto current = settings_cache_.latest();
        if (!current)
            return;
        gateway_.game_tick(*current, settings_cache_.revision());
    }

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

    std::shared_ptr<const EspSettingsSnapshot> EspFeature::settings() const noexcept
    {
        return settings_cache_.latest();
    }

    std::shared_ptr<const EspWorldSnapshot> EspFeature::world() const noexcept
    {
        return gateway_.world();
    }

    std::optional<ta::foundation::math::CameraFrame> EspFeature::camera() const
    {
        return gateway_.camera();
    }


}
