#pragma once
#include <stdint.h>
#include <string>

class asITypeInfo;
class asIScriptObject;
class asIScriptFunction;

namespace Deer {
    namespace ScriptEngine {
        struct ComponentScript {
        public:
            ComponentScript(asITypeInfo* type);

            void initialize();
            void tick();
        private:
            asITypeInfo* scriptType;
            asIScriptFunction* startFunction;
            asIScriptFunction* updateFunction;
        };

        void loadScripts();
        void unloadScripts();

        void initializeExecution();
        void tickExecution();
        void endExecution();

        void clearComponentScripts();

        ComponentScript& getComponentScript(uint16_t);
        ComponentScript& createComponentScript(const std::string& scriptName);
        void destroyComponentScript(uint16_t);
    }
}