#pragma once

#include <hilbert/kernel/utility.hpp>

namespace hilbert::kernel::input {

  enum : uint32_t {
    LEFT_SHIFT  = 1 <<  8,
    RIGHT_SHIFT = 1 <<  9,
    LEFT_CTRL   = 1 << 10,
    RIGHT_CTRL  = 1 << 11,
    LEFT_ALT    = 1 << 12,
    RIGHT_ALT   = 1 << 13,
    LEFT_WIN    = 1 << 14,
    RIGHT_WIN   = 1 << 15,
    CAPS_LOCK   = 1 << 16,
    NUM_LOCK    = 1 << 17,
    BREAK       = 1 << 18,
  };

  enum buttons_t : uint8_t {
    LEFT_BUTTON = 1,
    RIGHT_BUTTON = 2,
    MIDDLE_BUTTON = 4
  };

  struct input_packet {
    union {
      struct {
        int16_t x_change;
        int16_t y_change;
        buttons_t buttons;
      } mouse;
      uint32_t keyboard;
    };
    bool is_mouse;
  };

  extern utility::queue<input_packet> *input_queue;

  //notify a process waiting for input
  void got_input();

  //must be post switch to kernel page tables and mounting of file systems
  void init_input();

}
