#pragma once
#include <string>
#include "glm/glm.hpp"
#include "DeerStudio/EditorEngine/API/GenericRefStructs.h"

class asIScriptFunction;
class CScriptAny;

namespace Deer {
    namespace EditorEngine {
        namespace DragDropPayload {
            extern CScriptAny* payload;
        }

        // Renders the ui elements in the same line
        void sameline();
        // Renders a line separator
        void separator();

        // Renders a button
        bool button(std::string&);
        // Renders a button at the end
        bool buttonCenter(std::string&);
        // Renders a button at the end
        bool buttonEnd(std::string&);
        
        // Renders a text
        void text(std::string&);
        // Renders a text
        void textCenter(std::string&);
        // Renders a text
        void textEnd(std::string&);
        
        // Renders a text with the defined rgb values from range [0.0, 1.0]
        void textColor(float r, float g, float b, std::string& msg);
        // Renders a big text
        void title(std::string&);
        // Renders a big text
        void titleCenter(std::string&);
        // Renders a big text
        void titleEnd(std::string&);

        // Renders a big text in the center of a specified height
        void titleCenterY(std::string&, int);

        // Renders a icon in the specified size in pixels
        void drawIcon(std::string& iconId, int size);
        // Renders a icon in the specified size in pixels at the center
        void drawIconCentered(std::string& iconId, int size);

        // Renders a icon in the specified size in pixels
        void drawFrameBuffer(FrameBufferHandleStruct frameBuffer, int sizeX, int sizeY);
        // Renders a icon in the specified size in pixels
        void drawFrameBufferCentered(FrameBufferHandleStruct frameBuffer, int sizeX, int sizeY);

        // Returns if the specified mouse button is clicked on the last element
        bool isItemClicked(int mouse);
        // Returns if the specified mouse button is double clicked
        bool isMouseDoubleClicked(int mouse);

        bool isKeyDown(int);
        bool isKeyPressed(int);

        bool isMouseDraggin(int);
        float getMouseDragDeltaX();
        float getMouseDragDeltaY();
        float getMouseDeltaX();
        float getMouseDeltaY();

        void disablePannelPadding(bool);

        int getAvailableSizeX();
        int getAvailableSizeY();

        float slider(std::string&, float, float, float);
        int sliderInt(std::string&, int, int, int);
        
        // Draws a button for a popup menu
        bool menuItem(std::string&);
        // Draws a button disabled
        void menuItemDisabled(std::string&);
        // Draws a space where you can put buttons inside
        void menuSpace(std::string&, CScriptAny*, asIScriptFunction*);
        
        // Initializes the drag drop source with the id and the data you want to pass
        void dragDropSource(std::string&, CScriptAny*, std::string&);
        // Prepares the function to accept payload with the id and calls the function with the data
        void dragDropTarget(std::string&, CScriptAny*, asIScriptFunction*);

        // Draws a simple input with a label, input and output string
        bool inputText(std::string& label, std::string&, std::string&);
        // Draws a simple checkbox
        bool checkbox(std::string& label, bool);
        // Draws a simple checkbox
        bool checkboxDisabled(std::string& label, bool);
        // Draws a complex slider that with double click you can set a specific value
        float magicSlider(std::string&, float, float);
        // Draws a complex slider that with double click you can set a specific value in vec3
        glm::vec3 magicSlider3(std::string&, glm::vec3, float);
        // Returns if the current executing pannel is active
        bool isPannelActive();
        
        void registerUIFunctions();
        void registerUIStructs();
    }
}
