#pragma once

#include <GL/glew.h>
#include <GLFW/glfw3.h>

#include "utils.h"

namespace kek {

typedef generic_callable_t<GLFWwindow *> PeriodicCallback; // periodicCallback(GLFWwindow *window)
typedef generic_callable_t<GLFWwindow *, int, int, int, int> KeyCallback; // keyCallback(GLFWwindow *window, int key, int scancode, int action, int mods)
typedef generic_callable_t<GLFWwindow *, double, double> MouseCallback; // mouseCallback(GLFWwindow *window, double x, double y)

typedef unsigned int InputListener;
typedef unsigned int GLFWKey;
typedef unsigned int GLFWKeyState;
typedef unsigned int KeyMapping;
typedef unsigned int GLFWMouseButton;

struct KeyMappingData {
	std::string name;
	GLFWKey key;
};

}

namespace kek::Input {

InputListener addPeriodicCallback(PeriodicCallback callback);

void removePeriodicCallback(InputListener listener);

InputListener addKeyListener(KeyCallback callback);

void removeKeyListener(InputListener listener);

InputListener addMouseListener(MouseCallback callback);

void removeMouseListener(InputListener listener);

KeyMapping createKeyMapping(std::string name, GLFWKey defaultKey);

void reassignKeyMapping(KeyMapping mapping, GLFWKey key);

KeyMappingData getKeyMapping(KeyMapping mapping);

GLFWKeyState getKeyState(KeyMapping mapping);

}
