#include "input.h"

#include <map>

#include "internal.h"

namespace kek::Input {

static InputListener nextID = 0;

InputListener addPeriodicCallback(PeriodicCallback callback) {
	InputListener id = nextID++;
	kekData.periodicCallbacks.emplace(id, callback);
	return id;
}

void removePeriodicCallback(InputListener listener) {
	kekData.periodicCallbacks.erase(listener);
}

InputListener addKeyListener(KeyCallback callback) {
	InputListener id = nextID++;
	kekData.keyCallbacks.emplace(id, callback);
	return id;
}

void removeKeyListener(InputListener listener) {
	kekData.keyCallbacks.erase(listener);
}

InputListener addMouseListener(MouseCallback callback) {
	InputListener id = nextID++;
	kekData.mouseCallbacks.emplace(id, callback);
	return id;
}

void removeMouseListener(InputListener listener) {
	kekData.mouseCallbacks.erase(listener);
}

}
