#ifndef KEY_EVENT_HPP
#define KEY_EVENT_HPP

#include "event.hpp"

namespace OpenEngine {
    class OE_API KeyEvent
        : public Event
    {
        public:
            inline int GetKeyCode() const { return keycode; }
            inline int GetScanCode() const { return scancode; }
            inline int GetMods() const { return mods; }

            EVENT_CLASS_CATEGORY(EventCategoryInput | EventCategoryKeyboard)

        protected:
            KeyEvent(int keycode, int scancode, int mods)
                : keycode(keycode), scancode(scancode), mods(mods)
            {
            }

            int keycode;
            int scancode;
            int mods;
    };

    class OE_API KeyPressedEvent
        : public KeyEvent
    {
        public:
            KeyPressedEvent(int keycode, int scancode, int repeat_count, int mods)
                : KeyEvent(keycode, scancode, mods), repeat_count(repeat_count)
            {
            }

            inline int GetRepeatCount() { return repeat_count; };

            std::string ToString() const override;

            EVENT_CLASS_TYPE(KeyPressed)

        private:
            int repeat_count;
    };

    class OE_API KeyReleasedEvent
        : public KeyEvent
    {
        public:
            KeyReleasedEvent(int keycode, int scancode, int mods)
                : KeyEvent(keycode, scancode, mods)
            {
            }
            
            std::string ToString() const override;

            EVENT_CLASS_TYPE(KeyReleased)
    };

    class OE_API KeyTypedEvent
        : public KeyEvent
    {
        public:
            KeyTypedEvent(int keycode)
                : KeyEvent(keycode, 0, 0)
            {
            }

            std::string ToString() const override;

            EVENT_CLASS_TYPE(KeyTyped)
    };
}

#endif // KEY_EVENT_HPP
