#pragma once

#include <Common/Common.hpp>

#include <chrono>
#include <atomic>

class CCSGOInput;
class CUserCmd;
class IGameEvent;

class IMisc
{
public:
	virtual void OnRender() = 0;
	virtual void OnClientOutput() = 0;
	virtual void OnCreateMove( CCSGOInput* pInput , CUserCmd* pUserCmd ) = 0;
	virtual void OnFrameStageNotify( int FrameStage ) = 0;
	virtual void OnFireEventClientSide( IGameEvent* pGameEvent ) = 0;
};

class CMisc final : public IMisc
{
public:
	virtual void OnRender() override;
	virtual void OnClientOutput() override;
	virtual void OnCreateMove( CCSGOInput* pInput , CUserCmd* pUserCmd ) override;
	virtual void OnFrameStageNotify( int FrameStage ) override;
	virtual void OnFireEventClientSide( IGameEvent* pGameEvent ) override;

private:
	auto RunTriggerbot( CCSGOInput* pInput , CUserCmd* pUserCmd ) -> void;

private:
	std::chrono::steady_clock::time_point m_HitTime{};
	std::chrono::steady_clock::time_point m_HitSoundTime{};

private:
	bool m_bTriggerToggledOn = false;
	bool m_bTriggerKeyDown = false;
	bool m_bTriggerShooting = false;
	std::chrono::steady_clock::time_point m_TriggerArmTime{};
	std::chrono::steady_clock::time_point m_ShotStartTime{};

	std::atomic_bool m_bTargetInCrosshair = false;
	std::atomic_bool m_bTriggerFiring = false;
};

auto GetMisc() -> CMisc*;
