package net.northking.cctp.upperComputer.constants;

import net.northking.cctp.upperComputer.driver.agent.command.KeyEventCommand;

public enum KeyBoardCodeEnum {
    ESCAPE("Escape", KeyEventCommand.KEYCODE_ESCAPE),
    F1("F1",KeyEventCommand.KEYCODE_F1),
    F2("F2",KeyEventCommand.KEYCODE_F2),
    F3("F3",KeyEventCommand.KEYCODE_F3),
    F4("F4",KeyEventCommand.KEYCODE_F4),
    F5("F5",KeyEventCommand.KEYCODE_F5),
    F6("F6",KeyEventCommand.KEYCODE_F6),
    F7("F7",KeyEventCommand.KEYCODE_F7),
    F8("F8",KeyEventCommand.KEYCODE_F8),
    F9("F9",KeyEventCommand.KEYCODE_F9),
    F10("F10",KeyEventCommand.KEYCODE_F10),
    F11("F11",KeyEventCommand.KEYCODE_F11),
    F12("F12",KeyEventCommand.KEYCODE_F12),
    KEYCODE_GRAVE("`",KeyEventCommand.KEYCODE_GRAVE),
    NUMBER0("0",KeyEventCommand.KEYCODE_0),
    NUMBER1("1",KeyEventCommand.KEYCODE_1),
    NUMBER2("2",KeyEventCommand.KEYCODE_2),
    NUMBER3("3",KeyEventCommand.KEYCODE_3),
    NUMBER4("4",KeyEventCommand.KEYCODE_4),
    NUMBER5("5",KeyEventCommand.KEYCODE_5),
    NUMBER6("6",KeyEventCommand.KEYCODE_6),
    NUMBER7("7",KeyEventCommand.KEYCODE_7),
    NUMBER8("8",KeyEventCommand.KEYCODE_8),
    NUMBER9("9",KeyEventCommand.KEYCODE_9),
    KEYCODE_MINUS("-",KeyEventCommand.KEYCODE_MINUS),
    KEYCODE_EQUALS("=",KeyEventCommand.KEYCODE_EQUALS),
    KEYCODE_GRAVE_UP("~",KeyEventCommand.KEYCODE_GRAVE),
    NUMBER0_UP(")",KeyEventCommand.KEYCODE_0),
    NUMBER1_UP("!",KeyEventCommand.KEYCODE_1),
    NUMBER2_UP("@",KeyEventCommand.KEYCODE_2),
    NUMBER3_UP("#",KeyEventCommand.KEYCODE_3),
    NUMBER4_UP("$",KeyEventCommand.KEYCODE_4),
    NUMBER5_UP("%",KeyEventCommand.KEYCODE_5),
    NUMBER6_UP("^",KeyEventCommand.KEYCODE_6),
    NUMBER7_UP("&",KeyEventCommand.KEYCODE_7),
    NUMBER8_UP("*",KeyEventCommand.KEYCODE_8),
    KEYCODE_NUMPAD_MULTIPLY("_*",KeyEventCommand.KEYCODE_NUMPAD_MULTIPLY),
    NUMBER9_UP("(",KeyEventCommand.KEYCODE_9),
    KEYCODE_MINUS_UP("_",KeyEventCommand.KEYCODE_MINUS),
    KEYCODE_NUMPAD_SUBTRACT("__",KeyEventCommand.KEYCODE_NUMPAD_SUBTRACT),
    KEYCODE_EQUALS_UP("+",KeyEventCommand.KEYCODE_EQUALS),
    KEYCODE_NUMPAD_ADD("_+",KeyEventCommand.KEYCODE_NUMPAD_ADD),
    KEYCODE_ENTER("Enter",KeyEventCommand.KEYCODE_ENTER),
    KEYCODE_DEL("Backspace",KeyEventCommand.KEYCODE_DEL),
    KEYCODE_TAB("Tab",KeyEventCommand.KEYCODE_TAB),
    KEYCODE_CAPS_LOCK("CapsLock",KeyEventCommand.KEYCODE_CAPS_LOCK),
    KEYCODE_SHIFT_LEFT("Shift",KeyEventCommand.KEYCODE_SHIFT_LEFT),
    KEYCODE_CTRL_LEFT("Control",KeyEventCommand.KEYCODE_CTRL_LEFT),
    KEYCODE_META_LEFT("Meta",KeyEventCommand.KEYCODE_META_LEFT),
    KEYCODE_ALT_LEFT("Alt",KeyEventCommand.KEYCODE_ALT_LEFT),
    KEYCODE_SPACE(" ",KeyEventCommand.KEYCODE_SPACE),
    FN("Fn",KeyEventCommand.KEYCODE_SPACE),
    KEYCODE_TV_CONTENTS_MENU("ContextMenu",KeyEventCommand.KEYCODE_TV_CONTENTS_MENU),
    KEYCODE_SLASH("/",KeyEventCommand.KEYCODE_SLASH),
    KEYCODE_BACKSLASH("\\",KeyEventCommand.KEYCODE_BACKSLASH),
    KEYCODE_COMMA(",",KeyEventCommand.KEYCODE_COMMA),
    KEYCODE_PERIOD(".",KeyEventCommand.KEYCODE_PERIOD),
    KEYCODE_SEMICOLON(";",KeyEventCommand.KEYCODE_SEMICOLON),
    KEYCODE_APOSTROPHE("'",KeyEventCommand.KEYCODE_APOSTROPHE),
    KEYCODE_LEFT_BRACKET("[",KeyEventCommand.KEYCODE_LEFT_BRACKET),
    KEYCODE_RIGHT_BRACKET("]",KeyEventCommand.KEYCODE_RIGHT_BRACKET),
    KEYCODE_SLASH_UP("?",KeyEventCommand.KEYCODE_SLASH),
    KEYCODE_BACKSLASH_UP("|",KeyEventCommand.KEYCODE_BACKSLASH),
    KEYCODE_COMMA_UP("<",KeyEventCommand.KEYCODE_COMMA),
    KEYCODE_PERIOD_UP(">",KeyEventCommand.KEYCODE_PERIOD),
    KEYCODE_SEMICOLON_UP(":",KeyEventCommand.KEYCODE_SEMICOLON),
    KEYCODE_APOSTROPHE_UP("\"",KeyEventCommand.KEYCODE_APOSTROPHE),
    KEYCODE_LEFT_BRACKET_UP("{",KeyEventCommand.KEYCODE_LEFT_BRACKET),
    KEYCODE_RIGHT_BRACKET_UP("}",KeyEventCommand.KEYCODE_RIGHT_BRACKET),
    KEYCODE_SYSTEM_NAVIGATION_UP("ArrowUp",KeyEventCommand.KEYCODE_SYSTEM_NAVIGATION_UP),
    KEYCODE_SYSTEM_NAVIGATION_DOWN("ArrowDown",KeyEventCommand.KEYCODE_SYSTEM_NAVIGATION_DOWN),
    KEYCODE_SYSTEM_NAVIGATION_LEFT("ArrowLeft",KeyEventCommand.KEYCODE_SYSTEM_NAVIGATION_LEFT),
    KEYCODE_SYSTEM_NAVIGATION_RIGHT("ArrowRight",KeyEventCommand.KEYCODE_SYSTEM_NAVIGATION_RIGHT),
    KEYCODE_FORWARD_DEL("Delete",KeyEventCommand.KEYCODE_FORWARD_DEL),
    KEYCODE_MOVE_END("End",KeyEventCommand.KEYCODE_MOVE_END),
    KEYCODE_PAGE_DOWN("PageDown",KeyEventCommand.KEYCODE_PAGE_DOWN),
    KEYCODE_PAGE_UP("PageUp",KeyEventCommand.KEYCODE_PAGE_UP),
    KEYCODE_INSERT("Insert",KeyEventCommand.KEYCODE_INSERT),
    KEYCODE_MOVE_HOME("Home",KeyEventCommand.KEYCODE_MOVE_HOME),
    KEYCODE_SYSRQ("PrintScreen",KeyEventCommand.KEYCODE_SYSRQ),
    KEYCODE_SCROLL_LOCK("ScrollLock",KeyEventCommand.KEYCODE_SCROLL_LOCK),
    KEYCODE_BREAK("Pause",KeyEventCommand.KEYCODE_BREAK),
    KEYCODE_A("a",KeyEventCommand.KEYCODE_A),
    KEYCODE_B("b",KeyEventCommand.KEYCODE_B),
    KEYCODE_C("c",KeyEventCommand.KEYCODE_C),
    KEYCODE_D("d",KeyEventCommand.KEYCODE_D),
    KEYCODE_E("e",KeyEventCommand.KEYCODE_E),
    KEYCODE_F("f",KeyEventCommand.KEYCODE_F),
    KEYCODE_G("g",KeyEventCommand.KEYCODE_G),
    KEYCODE_H("h",KeyEventCommand.KEYCODE_H),
    KEYCODE_I("i",KeyEventCommand.KEYCODE_I),
    KEYCODE_J("j",KeyEventCommand.KEYCODE_J),
    KEYCODE_K("k",KeyEventCommand.KEYCODE_K),
    KEYCODE_L("l",KeyEventCommand.KEYCODE_L),
    KEYCODE_M("m",KeyEventCommand.KEYCODE_M),
    KEYCODE_N("n",KeyEventCommand.KEYCODE_N),
    KEYCODE_O("o",KeyEventCommand.KEYCODE_O),
    KEYCODE_P("p",KeyEventCommand.KEYCODE_P),
    KEYCODE_Q("q",KeyEventCommand.KEYCODE_Q),
    KEYCODE_R("r",KeyEventCommand.KEYCODE_R),
    KEYCODE_S("s",KeyEventCommand.KEYCODE_S),
    KEYCODE_T("t",KeyEventCommand.KEYCODE_T),
    KEYCODE_U("u",KeyEventCommand.KEYCODE_U),
    KEYCODE_V("v",KeyEventCommand.KEYCODE_V),
    KEYCODE_W("w",KeyEventCommand.KEYCODE_W),
    KEYCODE_X("x",KeyEventCommand.KEYCODE_X),
    KEYCODE_Y("y",KeyEventCommand.KEYCODE_Y),
    KEYCODE_Z("z",KeyEventCommand.KEYCODE_Z),
    KEYCODE_A_LARGE("A",KeyEventCommand.KEYCODE_A),
    KEYCODE_B_LARGE("B",KeyEventCommand.KEYCODE_B),
    KEYCODE_C_LARGE("C",KeyEventCommand.KEYCODE_C),
    KEYCODE_D_LARGE("D",KeyEventCommand.KEYCODE_D),
    KEYCODE_E_LARGE("E",KeyEventCommand.KEYCODE_E),
    KEYCODE_F_LARGE("F",KeyEventCommand.KEYCODE_F),
    KEYCODE_G_LARGE("G",KeyEventCommand.KEYCODE_G),
    KEYCODE_H_LARGE("H",KeyEventCommand.KEYCODE_H),
    KEYCODE_I_LARGE("I",KeyEventCommand.KEYCODE_I),
    KEYCODE_J_LARGE("J",KeyEventCommand.KEYCODE_J),
    KEYCODE_K_LARGE("K",KeyEventCommand.KEYCODE_K),
    KEYCODE_L_LARGE("L",KeyEventCommand.KEYCODE_L),
    KEYCODE_M_LARGE("M",KeyEventCommand.KEYCODE_M),
    KEYCODE_N_LARGE("N",KeyEventCommand.KEYCODE_N),
    KEYCODE_O_LARGE("O",KeyEventCommand.KEYCODE_O),
    KEYCODE_P_LARGE("O",KeyEventCommand.KEYCODE_P),
    KEYCODE_Q_LARGE("Q",KeyEventCommand.KEYCODE_Q),
    KEYCODE_R_LARGE("R",KeyEventCommand.KEYCODE_R),
    KEYCODE_S_LARGE("S",KeyEventCommand.KEYCODE_S),
    KEYCODE_T_LARGE("T",KeyEventCommand.KEYCODE_T),
    KEYCODE_U_LARGE("U",KeyEventCommand.KEYCODE_U),
    KEYCODE_V_LARGE("V",KeyEventCommand.KEYCODE_V),
    KEYCODE_W_LARGE("W",KeyEventCommand.KEYCODE_W),
    KEYCODE_X_LARGE("X",KeyEventCommand.KEYCODE_X),
    KEYCODE_Y_LARGE("Y",KeyEventCommand.KEYCODE_Y),
    KEYCODE_Z_LARGE("Z",KeyEventCommand.KEYCODE_Z);


    public String getWebValue() {
        return webValue;
    }

    private String webValue;

    private int code;

    KeyBoardCodeEnum(String webValue, int code){
        this.webValue = webValue;
        this.code = code;
    }

    public static int getCode(String webValue,boolean numberBoard){
        if (numberBoard) {
            if ("*".equals(webValue)) {
                return KEYCODE_NUMPAD_MULTIPLY.code;
            } else if ("+".equals(webValue)) {
                return KEYCODE_NUMPAD_ADD.code;
            } else if ("-".equals(webValue)) {
                return KEYCODE_NUMPAD_SUBTRACT.code;
            }
        }
        for (KeyBoardCodeEnum value : KeyBoardCodeEnum.values()) {
            if (value.webValue.equals(webValue)) {
                return value.code;
            }
        }
        return -1;
    }
}
