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

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

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

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

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

            registerUIStructs();
            registerResourceTypeEnum();
            registerEntityStructs();
            registerMathStructs();
            registerFrameBufferStructs();
            registerEnvironmentStructs();
            registerDockPanel();
        }

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

    }
}