#pragma once
#include <cstdint>

// =================================================================
// EFT Offsets Header - Extracted from post-injection memory layout
// Supports modular features: ImGui overlays, ESP, Aimbot, Item ESP, etc.
// Usage: uintptr_t localPlayer = CameraManager + EFT::Offsets::Game::CameraManager::LocalPlayer;
//        float stamina = *(float*)((LocalPlayer + EFT::Offsets::Game::LocalPlayer::Physical + EFT::Offsets::Game::Physical::Stamina) + EFT::Offsets::Game::Stamina::Current);
// =================================================================

namespace EFT::Offsets {
    // Base pointers (set at runtime via pattern scan or manual input)
    inline static uintptr_t g_TarkovApplication = 0;
    inline static uintptr_t g_CameraManager = 0;

    namespace Game {
        struct CameraManager {
            static constexpr uintptr_t EffectsController = 0x18;
            static constexpr uintptr_t LocalPlayer = 0x108;
            static constexpr uintptr_t ThermalVision = 0x48;
        };

        struct LocalPlayer {
            static constexpr uintptr_t Physical = 0x8F8;
            static constexpr uintptr_t HealthController = 0x940;
            static constexpr uintptr_t HandsController = 0x960;
            static constexpr uintptr_t InventoryController = 0x958;
            static constexpr uintptr_t Profile = 0x8E0;
            static constexpr uintptr_t FirearmsController = 0xD0;  // FireArmsPTR
        };

        struct Physical {
            static constexpr uintptr_t Stamina = 0x68;
            static constexpr uintptr_t HandsStamina = 0x70;
            static constexpr uintptr_t Oxygen = 0x78;
        };

        struct Stamina {
            static constexpr uintptr_t Current = 0x10;  // float
        };

        struct HealthController {
            static constexpr uintptr_t MetabolismDisabled = 0x25;  // byte
            static constexpr uintptr_t DamageCoeff = 0x34;         // float
        };

        struct HandsController {
            static constexpr uintptr_t WeaponPrefab = 0xD8;
            static constexpr uintptr_t WeaponData = 0x180;
            static constexpr uintptr_t Components = 0x40;
        };

        struct WeaponComponents {
            static constexpr uintptr_t Weapon = 0x10;
            static constexpr uintptr_t WeaponComponent = 0x20;
            static constexpr uintptr_t WeaponComponent2 = 0x30;
        };

        struct WeaponComponent {
            static constexpr uintptr_t Durability = 0x1C;      // float
            static constexpr uintptr_t MaxDurability = 0x18;   // float
            static constexpr uintptr_t WeaponItem = 0x10;
            static constexpr uintptr_t WeaponTemplate = 0x20;
            static constexpr uintptr_t MagSlotCache = 0xC8;    // From Weapon
        };

        struct WeaponTemplate {
            static constexpr uintptr_t AllowJam = 0x308;       // bool
            static constexpr uintptr_t AllowMisfire = 0x30A;   // bool
            static constexpr uintptr_t AllowSlide = 0x30B;     // bool
            static constexpr uintptr_t AllowOverheat = 0x320;  // bool
        };

        struct FirearmsController {
            static constexpr uintptr_t ProceduralWeaponAnimation = 0x20;
            static constexpr uintptr_t Shooting = 0x58;
        };

        struct Shooting {
            static constexpr uintptr_t NewShotRecoil = 0x20;
        };

        struct NewShotRecoil {
            static constexpr uintptr_t UseOffset = 0x10;        // bool?
            static constexpr uintptr_t RecoilEffectOn = 0x11;   // bool
            static constexpr uintptr_t ProgressPowerOn = 0x12;  // bool?
            static constexpr uintptr_t ProgressPowerShot = 0x14; // float?
        };

        struct Magazine {
            static constexpr uintptr_t ContainedItem = 0x48;
            static constexpr uintptr_t Cartridges = 0xA8;
        };

        struct Cartridges {
            static constexpr uintptr_t Items = 0x18;
            static constexpr uintptr_t Item = 0x10;             // Array base
            static constexpr uintptr_t Item0 = 0x20;            // First cartridge
            static constexpr uintptr_t Stack = 0x24;            // From Item
        };

        struct CartridgeItem {
            static constexpr uintptr_t BulletTemplate = 0x60;
            static constexpr uintptr_t BulletDamage = 0x150;           // float
            static constexpr uintptr_t BulletPenetrationPower = 0x164; // float
        };

        struct Profile {
            static constexpr uintptr_t Skills = 0x80;
            static constexpr uintptr_t FenceInfo = 0x120;
        };

        struct FenceInfo {
            static constexpr uintptr_t Standing = 0x60;
        };

        struct Skills {
            // Weapon Skills
            static constexpr uintptr_t Pistol = 0x230;
            static constexpr uintptr_t Revolver = 0x238;
            static constexpr uintptr_t SMG = 0x240;
            static constexpr uintptr_t Assault = 0x248;
            static constexpr uintptr_t Shotgun = 0x250;
            static constexpr uintptr_t Sniper = 0x258;
            static constexpr uintptr_t LMG = 0x260;
            static constexpr uintptr_t HMG = 0x268;
            static constexpr uintptr_t Launcher = 0x270;
            static constexpr uintptr_t AttachedLauncher = 0x278;
            static constexpr uintptr_t Melee = 0x288;
            static constexpr uintptr_t DMR = 0x290;
            static constexpr uintptr_t Throwing = 0x298;
            static constexpr uintptr_t AimDrills = 0x2A0;
            static constexpr uintptr_t RecoilControl = 0x2A8;
            static constexpr uintptr_t TroublesShooting = 0x2B0;  // Typo in original: TroublesSooting

            // General Skills
            static constexpr uintptr_t Perception = 0x528;
            static constexpr uintptr_t Intellect = 0x530;
            static constexpr uintptr_t Attention = 0x538;
            static constexpr uintptr_t Immunity = 0x540;
            static constexpr uintptr_t Charisma = 0x548;
            static constexpr uintptr_t Endurance = 0x558;
            static constexpr uintptr_t Strength = 0x560;
            static constexpr uintptr_t Vitality = 0x568;
            static constexpr uintptr_t Health = 0x570;
            static constexpr uintptr_t Metabolism = 0x578;
            static constexpr uintptr_t StressResistance = 0x580;
            static constexpr uintptr_t Sniping = 0x588;
            static constexpr uintptr_t CovertMovement = 0x590;
            static constexpr uintptr_t ProneMovement = 0x598;
            static constexpr uintptr_t LightVests = 0x5A0;
            static constexpr uintptr_t HeavyVests = 0x5A8;
            static constexpr uintptr_t WeaponModding = 0x5B0;
            static constexpr uintptr_t AdvancedModding = 0x5B8;
            static constexpr uintptr_t Lockpicking = 0x5C0;
            static constexpr uintptr_t Surgery = 0x5C8;
            static constexpr uintptr_t Search = 0x5D0;
            static constexpr uintptr_t WeaponTreatment = 0x5D8;
            static constexpr uintptr_t MagDrills = 0x5E0;
            static constexpr uintptr_t Freetrading = 0x5E8;
            static constexpr uintptr_t Barter = 0x5F0;
            static constexpr uintptr_t Crafting = 0x5F8;
            static constexpr uintptr_t HideoutManagement = 0x600;
            static constexpr uintptr_t BotReload = 0x750;
        };

        struct Skill {
            static constexpr uintptr_t CurrentValue = 0x28;  // float (51000.0f = max level)
        };

        struct InventoryController {
            static constexpr uintptr_t Inventory = 0x100;
        };

        struct Inventory {
            static constexpr uintptr_t Equipment = 0x18;
            static constexpr uintptr_t Slots = 0x80;
        };

        struct Slots {
            static constexpr uintptr_t BackpackSlot = 0x60;
        };

        struct BackpackSlot {
            static constexpr uintptr_t ContainedItem = 0x48;
            static constexpr uintptr_t Grids = 0x78;
        };

        struct Grid {
            static constexpr uintptr_t SearchableGrid0 = 0x20;  // First grid
            static constexpr uintptr_t ItemCollection = 0x48;
        };

        struct ItemCollection {
            static constexpr uintptr_t ItemList = 0x18;
            static constexpr uintptr_t Items = 0x10;  // Array: Item0 @ +0x20, Item1 @ +0x28, ..., Item10 @ +0x70 (step 8)
        };

        struct BackpackItem {
            static constexpr uintptr_t StackObjectsCount = 0x24;  // int
            static constexpr uintptr_t SpawnedInSession = 0x68;   // bool?
            static constexpr uintptr_t Template = 0x60;
        };

        struct ItemTemplate {
            static constexpr uintptr_t Name = 0x10;
        };

        struct ItemName {
            static constexpr uintptr_t String = 0x14;  // char*
        };

        // Raid Features (from TarkovApplication)
        struct TarkovApplication {
            static constexpr uintptr_t RaidSettings = 0xD0;
            static constexpr uintptr_t SelectedLocation = 0xA8;
        };

        struct RaidSettings {
            static constexpr uintptr_t MapId = 0x28;
            static constexpr uintptr_t ForceOnlineRaidInPVE = 0x32;   // bool
            static constexpr uintptr_t ForceOfflineRaidInPVE = 0x33;  // bool
            static constexpr uintptr_t EscapeTimeLimit = 0x84;        // float?
            static constexpr uintptr_t MaxBotsPerZone = 0x90;         // int
            static constexpr uintptr_t Waves = 0xB8;
        };

        struct MapIdObj {
            static constexpr uintptr_t MapName = 0x14;  // char*
        };

        struct Waves {
            static constexpr uintptr_t WildSpawnWave[8] = { 0x20, 0x28, 0x30, 0x38, 0x40, 0x48, 0x50, 0x58 };
        };

        struct WildSpawnWave {
            static constexpr uintptr_t TimeMin = 0x10;  // float
            static constexpr uintptr_t TimeMax = 0x14;  // float
            static constexpr uintptr_t SlotsMin = 0x18; // int
            static constexpr uintptr_t SlotsMax = 0x1C; // int
            static constexpr uintptr_t WildSpawnType = 0x2C;
        };

        // Thermal Vision (from CameraManager + 0x48)
        struct ThermalVision {
            static constexpr uintptr_t On = 0x20;               // bool
            static constexpr uintptr_t IsNoisy = 0x21;          // bool
            static constexpr uintptr_t IsMotionBlurred = 0x23;  // bool
            static constexpr uintptr_t IsGlitch = 0x24;         // bool
            static constexpr uintptr_t UnsharpRadiusBlur = 0x90; // float
            static constexpr uintptr_t UnsharpBias = 0x94;      // float
        };
    }
}