#ifndef SDLKEYMAPPING_H
#define SDLKEYMAPPING_H

#include "IMapping.h"

namespace Salamander
{

/*
** This header implements a mapping from SDL key definitions to Salamander ButtonEvent codes.
** Predominantly used by the platform classes during input.
*/
class SDLKeyMapping : public IMapping<SDLKey, int>
{
public:
	/*
	** Redeclaration of the constructor
	*/
	SDLKeyMapping(SDLKey key) : IMapping(key) {};

private:

	/*
	** Add all SDLKey -> SamanderKey mappings to the table.
	*/
	virtual void initialiseMapping()
	{
		SDLKeyMapping::addMapping(SDLK_UNKNOWN, ButtonEvent::buttonCode::Unknown);

		SDLKeyMapping::addMapping(SDLK_0, ButtonEvent::keyCode::Zero);
		SDLKeyMapping::addMapping(SDLK_1, ButtonEvent::keyCode::One);
		SDLKeyMapping::addMapping(SDLK_2, ButtonEvent::keyCode::Two);
		SDLKeyMapping::addMapping(SDLK_3, ButtonEvent::keyCode::Three);
		SDLKeyMapping::addMapping(SDLK_4, ButtonEvent::keyCode::Four);
		SDLKeyMapping::addMapping(SDLK_5, ButtonEvent::keyCode::Five);
		SDLKeyMapping::addMapping(SDLK_6, ButtonEvent::keyCode::Six);
		SDLKeyMapping::addMapping(SDLK_7, ButtonEvent::keyCode::Seven);
		SDLKeyMapping::addMapping(SDLK_8, ButtonEvent::keyCode::Eight);
		SDLKeyMapping::addMapping(SDLK_9, ButtonEvent::keyCode::Nine);

		SDLKeyMapping::addMapping(SDLK_a, ButtonEvent::keyCode::A);
		SDLKeyMapping::addMapping(SDLK_b, ButtonEvent::keyCode::B);
		SDLKeyMapping::addMapping(SDLK_c, ButtonEvent::keyCode::C);
		SDLKeyMapping::addMapping(SDLK_d, ButtonEvent::keyCode::D);
		SDLKeyMapping::addMapping(SDLK_e, ButtonEvent::keyCode::E);
		SDLKeyMapping::addMapping(SDLK_f, ButtonEvent::keyCode::F);
		SDLKeyMapping::addMapping(SDLK_g, ButtonEvent::keyCode::G);
		SDLKeyMapping::addMapping(SDLK_h, ButtonEvent::keyCode::H);
		SDLKeyMapping::addMapping(SDLK_i, ButtonEvent::keyCode::I);
		SDLKeyMapping::addMapping(SDLK_j, ButtonEvent::keyCode::J);
		SDLKeyMapping::addMapping(SDLK_k, ButtonEvent::keyCode::K);
		SDLKeyMapping::addMapping(SDLK_l, ButtonEvent::keyCode::L);
		SDLKeyMapping::addMapping(SDLK_m, ButtonEvent::keyCode::M);
		SDLKeyMapping::addMapping(SDLK_n, ButtonEvent::keyCode::N);
		SDLKeyMapping::addMapping(SDLK_o, ButtonEvent::keyCode::O);
		SDLKeyMapping::addMapping(SDLK_p, ButtonEvent::keyCode::P);
		SDLKeyMapping::addMapping(SDLK_q, ButtonEvent::keyCode::Q);
		SDLKeyMapping::addMapping(SDLK_r, ButtonEvent::keyCode::R);
		SDLKeyMapping::addMapping(SDLK_s, ButtonEvent::keyCode::S);
		SDLKeyMapping::addMapping(SDLK_t, ButtonEvent::keyCode::T);
		SDLKeyMapping::addMapping(SDLK_u, ButtonEvent::keyCode::U);
		SDLKeyMapping::addMapping(SDLK_v, ButtonEvent::keyCode::V);
		SDLKeyMapping::addMapping(SDLK_w, ButtonEvent::keyCode::W);
		SDLKeyMapping::addMapping(SDLK_x, ButtonEvent::keyCode::X);
		SDLKeyMapping::addMapping(SDLK_y, ButtonEvent::keyCode::Y);
		SDLKeyMapping::addMapping(SDLK_z, ButtonEvent::keyCode::Z);

		SDLKeyMapping::addMapping(SDLK_INSERT, ButtonEvent::keyCode::Insert);
		SDLKeyMapping::addMapping(SDLK_DELETE, ButtonEvent::keyCode::Delete);
		SDLKeyMapping::addMapping(SDLK_HOME, ButtonEvent::keyCode::Home);
		SDLKeyMapping::addMapping(SDLK_END, ButtonEvent::keyCode::End);
		SDLKeyMapping::addMapping(SDLK_PAGEUP, ButtonEvent::keyCode::PageUp);
		SDLKeyMapping::addMapping(SDLK_PAGEDOWN, ButtonEvent::keyCode::PageDown);
		
		SDLKeyMapping::addMapping(SDLK_UP, ButtonEvent::keyCode::Up);
		SDLKeyMapping::addMapping(SDLK_DOWN, ButtonEvent::keyCode::Down);
		SDLKeyMapping::addMapping(SDLK_LEFT, ButtonEvent::keyCode::Left);
		SDLKeyMapping::addMapping(SDLK_RIGHT, ButtonEvent::keyCode::Right);

		SDLKeyMapping::addMapping(SDLK_SPACE, ButtonEvent::keyCode::Space);
		SDLKeyMapping::addMapping(SDLK_RETURN, ButtonEvent::keyCode::Return);
		SDLKeyMapping::addMapping(SDLK_BACKSPACE, ButtonEvent::keyCode::Backspace);
		SDLKeyMapping::addMapping(SDLK_TAB, ButtonEvent::keyCode::Tab);

		SDLKeyMapping::addMapping(SDLK_CAPSLOCK, ButtonEvent::keyCode::CapsLock);
		//ButtonEvent::keyCode::Shift
		//ButtonEvent::keyCode::Control
		//ButtonEvent::keyCode::Alternate

		SDLKeyMapping::addMapping(SDLK_ESCAPE, ButtonEvent::keyCode::Escape);
		SDLKeyMapping::addMapping(SDLK_F1, ButtonEvent::keyCode::F1);
		SDLKeyMapping::addMapping(SDLK_F2, ButtonEvent::keyCode::F2);
		SDLKeyMapping::addMapping(SDLK_F3, ButtonEvent::keyCode::F3);
		SDLKeyMapping::addMapping(SDLK_F4, ButtonEvent::keyCode::F4);
		SDLKeyMapping::addMapping(SDLK_F5, ButtonEvent::keyCode::F5);
		SDLKeyMapping::addMapping(SDLK_F6, ButtonEvent::keyCode::F6);
		SDLKeyMapping::addMapping(SDLK_F7, ButtonEvent::keyCode::F7);
		SDLKeyMapping::addMapping(SDLK_F8, ButtonEvent::keyCode::F8);
		SDLKeyMapping::addMapping(SDLK_F9, ButtonEvent::keyCode::F9);
		SDLKeyMapping::addMapping(SDLK_F10, ButtonEvent::keyCode::F10);
		SDLKeyMapping::addMapping(SDLK_F11, ButtonEvent::keyCode::F11);
		SDLKeyMapping::addMapping(SDLK_F12, ButtonEvent::keyCode::F12);

		SDLKeyMapping::addMapping(SDLK_PRINT, ButtonEvent::keyCode::PrintScreen);
		SDLKeyMapping::addMapping(SDLK_SCROLLOCK, ButtonEvent::keyCode::ScrollLock);
		SDLKeyMapping::addMapping(SDLK_PAUSE, ButtonEvent::keyCode::Pause);
	}
};

}

#endif // SDLKEYMAPPING_H