package net.northking.cctp.upperComputer.constants;

import net.northking.cctp.upperComputer.driver.harmony.hdc.HarmonyKeyCode;

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


    public String getWebValue() {
        return webValue;
    }

    private String webValue;

    private int code;

    HarmonyKeyBoardCodeEnum(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 (HarmonyKeyBoardCodeEnum value : HarmonyKeyBoardCodeEnum.values()) {
            if (value.webValue.equals(webValue)) {
                return value.code;
            }
        }
        return -1;
    }

    public int getCode() {
        return code;
    }
}
