#pragma once

#include "SDK/Player.h"
#include "SDK/Packet.h"
#include "SDK/ContainerScreenController.h"
#include "SDK/ResourceLocation.h"
#include "SDK/TexturePtr.h"
#include "SDK/BedrockTextureData.h"
#include "SDK/ActorRenderData.h"
#include "SDK/UIControl.h"

#include "Datas/LanguageDatas.h"

class Mod {
public:
	class Data {
	public:
		float animation = 0.f;
		float y = 0.f;
	};

	class Setting {
	public:
		std::string name;
		void* ptr;
		void* max;
		void* min;
		int type;
		std::vector<std::string> list;
		bool visible;
		
		float size = 40.f;
		bool holding;

		int clicked;
		long long lastclicked;
		bool inputing;
		std::string inputs;
	};

	enum Category : int {
		COMBAT = 0,
		RENDER = 1,
		MOVEMENT = 2,
		PLAYER = 3,
		EXPLOIT = 4,
		GHOST = 5,
		OTHER = 6,
	};

	Data datas = {0.f, 0.f};
	std::vector<Setting*> settings;
	std::string name;
	std::string description;
	Category category;
	bool enabled = false;
	bool onlyenabled = true;
	bool onlyheld = true;
	std::vector<int> keys = { };
	bool visible = true;
	Mod(std::string name, std::string description, Category category) {
		this->name = name;
		this->description = description;
		this->category = category;

		settings.push_back(new Setting{ _("Visible"), &visible, 0, 0, 0, {}, true });
	}

	virtual auto getMode() -> std::string;

	virtual auto onEnabled() -> void;
	virtual auto onDisabled() -> void;
	virtual auto onAnyEnabled() -> void;
	virtual auto onAnyDisabled() -> void;

	virtual auto onClient() -> void;

	virtual auto onClient2() -> void;
	virtual auto onClient3() -> void;
	virtual auto onClient4() -> void;

	virtual auto onKilledPlayer(Actor& actor) -> void;
	virtual auto onWinGame() -> void;

	virtual auto onImGuiRender() -> void;
	virtual auto onKeyboard(int key, bool* held, bool* cancel) -> void;
	virtual auto onMouse(char button, char action, bool* cancel) -> void;

	virtual auto onSetupAndRender() -> void;

	virtual auto onBaseTick(Player* _this) -> void;
	virtual auto onGetShadowRadius(Player* _this, float* radius) -> void;
	virtual auto onFire(Player* _this, bool* isonfire) -> void;
	virtual auto onSwing(Player* _this, bool* cancel) -> void;
	virtual auto onWorldTick(Player* _this) -> void;
	virtual auto onBobHurt(glm::mat4* matrix, bool* cancel) -> void;
	virtual auto onBobHurt_cause(bool* cancel) -> void;

	virtual auto onSwingDuration(int* duration) -> void;

	virtual auto onPacketReceive(Packet* packet, bool* cancel) -> void;

	virtual auto onPacketSendBefore(Packet* packet) -> void;
	virtual auto onPacketSendBefore2(Packet* packet) -> void;
	virtual auto onPacketSendAfter(Packet* packet, bool* cancel) -> void;
	virtual auto onPacketSendAfter2(Packet* packet, bool* cancel) -> void;
	virtual auto onPacketSendAfter3(Packet* packet, bool* cancel) -> void;

	virtual auto onViewPerspectiveBefore(int* perspective) -> void;
	virtual auto onViewPerspectiveAfter(int* perspective) -> void;
	virtual auto onGetGamma(float* gamma) -> void;
	virtual auto onGetFov(float* fov) -> void;

	virtual auto onContainerScreenSlotHovered(ContainerScreenController* _this, std::string containerName, int64_t slot) -> void;
	virtual auto onContainerScreenTick(ContainerScreenController* _this) -> void;
	
	virtual auto onGetTime(float* time) -> void;

	virtual auto onDimensionChanged() -> void;
	virtual auto isPreGame(bool* state) -> void;

	virtual auto onStartDestroyBlock() -> void;
	virtual auto onStopDestroyBlock() -> void;
	virtual auto onGetPickRange(float* range) -> void;
	virtual auto onAttack(Actor& target) -> void;

	virtual auto onGetActorOverlayColor(ImColor* color) -> void;

	virtual auto onGetTexture(ResourceLocation* location, mce::TexturePtr* ptr) -> void;
	virtual auto onDrawImage(BedrockTextureData* ptr, glm::vec2* pos) -> void;

	virtual auto onRunUpdateCycle(bool* cancel) -> void;

	virtual auto onItemRenderer_render(ActorRenderData* data) -> void;

	virtual auto onCameraComponentUpdate(glm::vec4* angle) -> void;

	virtual auto onUIControlGetPosition(UIControl* _this, glm::vec2* position) -> void;

	virtual auto onConnectionRequest(std::string* deviceId) -> void;

	virtual auto onItemInHandRenderer_render(ItemStack* itemstack) -> void;

	virtual auto onGeneralSettingsScreenController_onCreate(bool* isGlobalSettings, bool* reloadTexturePacksOnExit) -> void;

	virtual auto onResourcePackManager_composeFullStack() -> void;

	virtual auto onSettingScreen_ExitBefore() -> void;
	virtual auto onSettingScreen_ExitAfter() -> void;

	virtual auto onRenderChunkCoordinator_handleVisibilityUpdates(bool* cancel) -> void;

	virtual auto onRenderOrder_execute(bool* cancel) -> void;


	virtual auto onRenderActorBefore(Actor* actor, glm::vec3* camera, glm::vec3* position) -> void;
	virtual auto onRenderActorAfter(Actor* actor) -> void;

	virtual auto onInterpolatedHeadYaw(Player* _this, float* yaw) -> void;
	virtual auto onInterpolatedBodyYaw(Player* _this, float* yaw) -> void;
	

};
