#pragma once

#include "application/contracts/IApplicationTick.h"
#include "application/contracts/IGameTick.h"
#include "features/chams/IChamsGateway.h"
#include "features/chams/IChamsSettings.h"
#include "features/common/SettingsCache.h"

namespace ta::features::chams
{
    class ChamsFeature final : public ta::application::IApplicationTick,
                               public ta::application::IGameTick
    {
    public:
        ChamsFeature(IChamsGateway& gateway, IChamsSettings& settings) noexcept
            : gateway_(gateway), settings_(settings)
        {
        }

        void initialize();
        void on_application_tick() override;
        void on_game_tick() override;
        void reset_session() noexcept;

    private:
        [[nodiscard]] ChamsSettings current_settings() const;

        IChamsGateway& gateway_;
        IChamsSettings& settings_;
        ta::features::SettingsCache<ChamsSettings> settings_cache_;
    };
}
