#include "DeerStudio/EditorEngine.h"
#include "DeerStudio/EditorEngine/API.h"
#include "DeerStudio/EditorEngine/ErrorHandle.h"

#include "angelscript.h"
#include "scriptany.h"
#include "scripthandle.h"

namespace Deer {
	namespace EditorEngine {
		void registerAssetTypeEnum() {
			AS_RET_CHECK(scriptEngine->RegisterEnum("AssetType"));
			AS_CHECK(scriptEngine->RegisterEnumValue("AssetType", "None",
			                                         (int)AssetType::NONE));
			AS_CHECK(scriptEngine->RegisterEnumValue("AssetType", "Shader",
			                                         (int)AssetType::SHADER));
			AS_CHECK(scriptEngine->RegisterEnumValue("AssetType", "Mesh",
			                                         (int)AssetType::MESH));
		}

		void registerEditorEngineStructs() {
			RegisterScriptHandle(scriptEngine);
			RegisterScriptAny(scriptEngine);

			AS_RET_CHECK(scriptEngine->RegisterInterface("DockPanel"));
			AS_RET_CHECK(scriptEngine->RegisterInterfaceMethod(
			    "DockPanel", "void onRender()"));

			AS_RET_CHECK(scriptEngine->RegisterInterface("ServiceScript"));

			AS_CHECK(scriptEngine->RegisterFuncdef("void ReciverFunc(any@)"));
			AS_CHECK(
			    scriptEngine->RegisterFuncdef("void TransferFunc(any@, any@)"));

			registerUIStructs();
			registerAssetTypeEnum();
			registerEntityStructs();
			registerMathStructs();
			registerFrameBufferStructs();
			registerEnvironmentStructs();
		}

	} // namespace EditorEngine
} // namespace Deer