#ifndef GAME_CLIENT_COMPONENTS_CMCLIENT_H
#define GAME_CLIENT_COMPONENTS_CMCLIENT_H
#include <engine/client/enums.h>
#include <engine/shared/console.h>

#include <game/client/component.h>

class CCMClient : public CComponent
{
	static void ConAutoTeam(IConsole::IResult *pResult, void *pUserData);
	static void ConAutoSwap(IConsole::IResult *pResult, void *pUserData);
	static void ConDumpSkin(IConsole::IResult *pResult, void *pUserData);

	class IEngineGraphics *m_pGraphics = nullptr;

	char m_TeamFollowed[128];
	int m_TeamNum;

	enum
	{
		AUTOSWAP_IDLE,
		AUTOSWAP_INIT,
		AUTOSWAP_DELAY,
		AUTOSWAP_UNSAFE
	} m_AutoSwapState;
	int m_AutoSwapDummy, m_AutoSwapDummyGuess, m_AutoSwapTarget, m_AutoSwapTargetGuess;
	int64_t m_AutoSwapDelayExpire, m_AutoSwapSafeStart;

	int m_IdleMoveNotifiedEnd[NUM_DUMMIES], m_IdlePositionStableStart[NUM_DUMMIES];
	vec2 m_IdlePosition[NUM_DUMMIES];

	bool m_IsInactive;
	int m_EmoteStop[NUM_DUMMIES];
	bool m_WasPaused[NUM_DUMMIES];
	int m_InactiveTimeout;

public:
	CCMClient();
	int Sizeof() const override { return sizeof(*this); }
	void OnConsoleInit() override;
	void OnInit() override;
	void OnReset() override;
	void OnUpdate() override;
	void OnNewSnapshot() override;
	void OnMessage(int MsgType, void *pRawMsg) override;
};

#endif
