#pragma once

enum class kKey : uint8_t
{
    Unknown,
    AndroidVolumeUp,
    AndroidVolumeDown,
    AndroidHome,
    AndroidBack,
    KeySpacebar,
    KeyA,
    KeyB,
    KeyC,
    KeyD,
    KeyE,
    KeyF,
    KeyG,
    KeyH,
    KeyI,
    KeyJ,
    KeyK,
    KeyL,
    KeyM,
    KeyN,
    KeyO,
    KeyP,
    KeyQ,
    KeyR,
    KeyS,
    KeyT,
    KeyU,
    KeyV,
    KeyW,
    KeyX,
    KeyY,
    KeyZ,
    Key0,
    Key1,
    Key2,
    Key3,
    Key4,
    Key5,
    Key6,
    Key7,
    Key8,
    Key9,
    KeyF1,
    KeyF2,
    KeyF3,
    KeyF4,
    KeyF5,
    KeyF6,
    KeyF7,
    KeyF8,
    KeyF9,
    KeyF10,
    KeyF11,
    KeyF12,
    KeyF13,
    KeyF14,
    KeyF15,
    KeyF16,
    KeyF17,
    KeyF18,
    KeyF19,
    KeyF20,
    KeyF21,
    KeyF22,
    KeyF23,
    KeyF24,
    KeyAlt,
    KeyCtrl,
    KeyShift,
    KeyTab,
    KeyEnter,
    KeyBackspace,
    KeyDel,
    KeyBracketLeft,
    KeyBracketRight,
};

enum class kEventResult : uint8_t
{
    Consumed,
    Available,
};

enum class kEventCategory : uint8_t
{
    MouseEvent,
    KeyEvent,
    ButtonEvent,
    GestureEvent,
    TouchEvent,
};

enum class kEventType : uint8_t
{
    MouseDownL,
    MouseDownR,
    MouseMove,
    MouseUpL,
    MouseUpR,
    MouseEnter,
    MouseLeave,
    MouseScroll,
    MouseCancel,
    MouseFocus,
    MouseUnfocus,
    GestureStart,
    GestureMove,
    GestureEnd,
    TouchTap,
    KeyDown,
    KeyUp,
    KeyChar,
    ButtonDown,
    ButtonUp,
};

enum class kEventSource : uint8_t
{
    Mouse,
    Touch,
    Stylus,
};

class Event
{
public:
    kEventCategory m_cat;
    kEventType m_type;
};

class MouseEvent : public Event
{
public:
    MouseEvent() { m_cat = kEventCategory::MouseEvent; }
    glm::vec2 m_pos;
    float m_pressure = 0;
    float m_scroll_delta = 0;
    bool m_eraser = false;
    kEventSource m_source = kEventSource::Mouse;
};

class KeyEvent : public Event
{
public:
    KeyEvent() { m_cat = kEventCategory::KeyEvent; }
    kKey m_key;
    char m_char;
};

class GestureEvent : public Event
{
public:
    GestureEvent() { m_cat = kEventCategory::GestureEvent; }
    float m_distance;
    float m_distance_delta;
    float m_angle;
    float m_angle_delta;
    glm::vec2 m_pos;
    glm::vec2 m_pos_delta;
};

class TouchEvent : public Event
{
public:
    TouchEvent() { m_cat = kEventCategory::TouchEvent; }
    glm::vec2 m_pos;
    int m_finger_count;
    int m_tap_count;
};
