#pragma once

#include <string>

#include "adapters/il2cpp/Il2CppObjectInstance.h"
#include "adapters/unity/bindings/UnityTypes.h"
#include "adapters/il2cpp/Il2CppCollections.h"
#include "adapters/unity/bindings/UnityApi.h"

namespace ta::adapters::eft::aimbot
{
    struct ScanResult
    {
        bool has_target = false;
        ta::adapters::unity::vector3 target{};
        std::string local_nickname;
    };

    class TargetScanner final
    {
    public:
        static ScanResult scan_target(ta::adapters::il2cpp::Il2CppObjectInstance game_world_instance,
                                      ta::adapters::il2cpp::Il2CppObjectInstance main_player,
                                      ta::adapters::unity::vector3 screen_center);

        static std::string read_nickname(ta::adapters::il2cpp::Il2CppObjectInstance player);

    private:
        static bool try_get_head_position(Il2CppObject* player_object, ta::adapters::unity::vector3& out_head_position);
    };
}
