#pragma once

// -----------------------------------------------------------------------------
// config.h
// -----------------------------------------------------------------------------
// Config: central runtime state shared by every feature thread and the
// hotkey listener. Holds feature toggles, hotkey codes, aim parameters and
// the currently selected aim bone. A single global instance (g_config)
// lives in config.cpp; the console menu and features both read it.
// -----------------------------------------------------------------------------

#include <cstdint>
#include <string>
#include <windows.h>

namespace cfg {

// Application name and version, displayed in the on-screen menu.
constexpr const char* kAppName = "CS2 Muhittin";
constexpr const char* kVersion = "2.2.0";

// Aim bone selection modes (aimstatus in the original cheat).
enum class AimMode
{
	Head,
	Chest,
	Stomach,
	Random,
	Off,
};

// Wallhack glow levels (HOME cycles through them).
enum class GlowLevel
{
	All,
	Enemy,
	Team,
	Off,
};

// Global cheat configuration and runtime state.
struct Config
{
	// Feature toggles (defaults match the original cheat).
	GlowLevel glowLevel = GlowLevel::All;
	bool radarEnabled = true;
	bool triggerEnabled = true;
	bool noFlashEnabled = false;
	bool webRadarEnabled = false;
	bool aimbotEnabled = true;

	// Hotkey codes (defaults match the original cheat).
	DWORD triggerKey = 4;            // MOUSE3 (middle mouse button)
	DWORD forceAim2Key = 18;         // ALT (aims at the nearest enemy)
	DWORD flickshotKey = 20;         // CAPS LOCK (one-shot flick: aim + fire)

	// Toggle hotkeys (defaults match the original cheat).
	DWORD glowToggleKey = 36;        // HOME
	DWORD radarToggleKey = 35;       // END
	DWORD aimModeKey = 46;           // DELETE (cycles aim modes)
	DWORD noFlashToggleKey = 34;     // PAGE DOWN
	DWORD webRadarToggleKey = 33;    // PAGE UP (web radar)
	DWORD aimbotToggleKey = 45;      // INSERT (aimbot)
	DWORD aimbotFireKey = 1;         // MOUSE1 (aim lock while spraying, shots > 1)
	DWORD aimbotLockKey = 4;         // MOUSE3 (hard aim lock, like the original)
	DWORD aimOffKey = 96;            // NUMPAD 0
	DWORD aimStomachKey = 98;        // NUMPAD 2
	DWORD aimChestKey = 100;         // NUMPAD 4
	DWORD aimHeadKey = 103;          // NUMPAD 7
	DWORD aimRandomKey = 101;        // NUMPAD 5

	// Aim parameters.
	int triggerDelayMs = 20;         // Triggerbot delay before firing (fixed).
	int smoothAmount = 50;           // Aim smoothness (100 = snap, higher = faster; fixed).
	float aimbotPunchScale = 2.0f;   // Recoil punch applied to the aim angle (original: 2)
	AimMode aimMode = AimMode::Head; // Currently selected aim bone mode.

	// Resolved bone indices (filled once at startup from the model).
	int boneHead = -1;    // "head_0"
	int boneChest = -1;   // "spine_3"
	int boneStomach = -1; // "spine_1"

	// Returns the currently selected bone index for the aim mode.
	int GetAimBone() const;

	// Returns a display string for the current aim mode.
	const char* GetAimModeName() const;

	// Returns a display string for the current glow level.
	const char* GetGlowLevelName() const;
};

// The single runtime configuration instance shared by all modules.
extern Config g_config;

} // namespace cfg