#ifndef DEFAULTKEYSMAP_H
#define DEFAULTKEYSMAP_H

#include "SparrowInput/keybindings.h"

class DefaultKeysMap : public IKeysMap
{
public:
    enum{MAIN_ACTION, SECONDARY_ACTION, TERTIARY_ACTION, MOVE_FORWARD, MOVE_BACKWARD, STRAFE_LEFT, STRAFE_RIGHT, JUMP,RUN,
         TOGGLE_NOCLIP, TOGGLE_PHYSICS_DEBUG, TOGGLE_CONSOLE,
         MOVE_CURSOR_LEFT, MOVE_CURSOR_RIGHT, HISTORY_UP,HISTORY_DOWN, TOGGLE_MOUSE_CURSOR, LEFT_CLICK,
         EXIT_GAME,LAST_DEFAULT_ACTION};

    DefaultKeysMap(){
        keys.push_back( {{MAIN_ACTION,input::MOUSE},            sf::Mouse::Left,     IKeysMap::PRESSED} );
        keys.push_back( {{SECONDARY_ACTION,input::MOUSE},       sf::Mouse::Right,    IKeysMap::PRESSED} );
        keys.push_back( {{TERTIARY_ACTION,input::MOUSE},        sf::Mouse::Middle,   IKeysMap::PRESSED} );
        keys.push_back( {{MOVE_FORWARD,input::KEYBOARD},        sf::Keyboard::Z,     IKeysMap::HOLD} );
        keys.push_back( {{MOVE_BACKWARD,input::KEYBOARD},       sf::Keyboard::S,     IKeysMap::HOLD} );
        keys.push_back( {{STRAFE_LEFT,input::KEYBOARD},         sf::Keyboard::Q,     IKeysMap::HOLD} );
        keys.push_back( {{STRAFE_RIGHT,input::KEYBOARD},        sf::Keyboard::D,     IKeysMap::HOLD} );
        keys.push_back( {{RUN,input::KEYBOARD},                 sf::Keyboard::LShift,IKeysMap::HOLD} );
        keys.push_back( {{JUMP,input::KEYBOARD},                sf::Keyboard::Space, IKeysMap::PRESSED} );
        keys.push_back( {{TOGGLE_NOCLIP,input::KEYBOARD},       sf::Keyboard::G,     IKeysMap::PRESSED} );
        keys.push_back( {{TOGGLE_PHYSICS_DEBUG,input::KEYBOARD},sf::Keyboard::P,     IKeysMap::PRESSED} );
        keys.push_back( {{TOGGLE_CONSOLE,input::KEYBOARD},      sf::Keyboard::F3,    IKeysMap::PRESSED} );
        keys.push_back( {{MOVE_CURSOR_LEFT,input::KEYBOARD},    sf::Keyboard::Left,  IKeysMap::PRESSED} );
        keys.push_back( {{MOVE_CURSOR_RIGHT,input::KEYBOARD},   sf::Keyboard::Right, IKeysMap::PRESSED} );
        keys.push_back( {{HISTORY_UP,input::KEYBOARD},          sf::Keyboard::Up,    IKeysMap::PRESSED} );
        keys.push_back( {{HISTORY_DOWN,input::KEYBOARD},        sf::Keyboard::Down,  IKeysMap::PRESSED} );
        keys.push_back( {{TOGGLE_MOUSE_CURSOR,input::KEYBOARD}, sf::Keyboard::M,     IKeysMap::PRESSED} );
        keys.push_back( {{EXIT_GAME,input::KEYBOARD},           sf::Keyboard::Escape,IKeysMap::PRESSED} );
        keys.push_back( {{LEFT_CLICK,input::MOUSE},             sf::Mouse::Left,     IKeysMap::PRESSED} );
    }

    static std::vector<Action> getDefaultContext()
    {
        return {
            {MAIN_ACTION,input::MOUSE},
            {SECONDARY_ACTION,input::MOUSE},
            {TERTIARY_ACTION,input::MOUSE},
            {MOVE_FORWARD,input::KEYBOARD},
            {MOVE_BACKWARD,input::KEYBOARD},
            {STRAFE_LEFT,input::KEYBOARD},
            {STRAFE_RIGHT,input::KEYBOARD},
            {JUMP,input::KEYBOARD},
            {RUN,input::KEYBOARD},
            {TOGGLE_NOCLIP,input::KEYBOARD},
            {TOGGLE_PHYSICS_DEBUG,input::KEYBOARD},
            {TOGGLE_MOUSE_CURSOR,input::KEYBOARD},
            {TOGGLE_CONSOLE,input::KEYBOARD},
            {EXIT_GAME,input::KEYBOARD}
            };
    }

    static std::vector<Action> getShellContext()
    {
        return {
            {TOGGLE_CONSOLE,input::KEYBOARD},
            {EXIT_GAME,input::KEYBOARD},
            {MOVE_CURSOR_LEFT,input::KEYBOARD},
            {MOVE_CURSOR_RIGHT,input::KEYBOARD},
            {HISTORY_UP,input::KEYBOARD},
            {HISTORY_DOWN,input::KEYBOARD}
        };
    }

    static std::vector<Action> getMenuContext(){
        return {
            {LEFT_CLICK,input::MOUSE},
            {EXIT_GAME,input::KEYBOARD},
            {TOGGLE_CONSOLE,input::KEYBOARD}
        };
    }
};

#endif // DEFAULTKEYSMAP_H
