/**
 * Keyboard functions
 */
export namespace Keyboard {
  /**
   * Keys for KeyboardEvent.key
   */
  export enum Keys {
    Backspace = "Backspace",
    Tab = "Tab",
    Enter = "Enter",
    Shift = "Shift",
    Control = "Control",
    Alt = "Alt",
    Pause = "Pause",
    CapsLock = "CapsLock",
    Escape = "Escape",
    Space = " ",
    PageUp = "PageUp",
    PageDown = "PageDown",
    End = "End",
    Home = "Home",
    ArrowLeft = "ArrowLeft",
    ArrowUp = "ArrowUp",
    ArrowRight = "ArrowRight",
    ArrowDown = "ArrowDown",
    PrintScreen = "PrintScreen",
    Insert = "Insert",
    Delete = "Delete",
    Digit0 = "0",
    Digit1 = "1",
    Digit2 = "2",
    Digit3 = "3",
    Digit4 = "4",
    Digit5 = "5",
    Digit6 = "6",
    Digit7 = "7",
    Digit8 = "8",
    Digit9 = "9",
    A = "A",
    B = "B",
    C = "C",
    D = "D",
    E = "E",
    F = "F",
    G = "G",
    H = "H",
    I = "I",
    J = "J",
    K = "K",
    L = "L",
    M = "M",
    N = "N",
    O = "O",
    P = "P",
    Q = "Q",
    R = "R",
    S = "S",
    T = "T",
    U = "U",
    V = "V",
    W = "W",
    X = "X",
    Y = "Y",
    Z = "Z",
    a = "a",
    b = "b",
    c = "c",
    d = "d",
    e = "e",
    f = "f",
    g = "g",
    h = "h",
    i = "i",
    j = "j",
    k = "k",
    l = "l",
    m = "m",
    n = "n",
    o = "o",
    p = "p",
    q = "q",
    r = "r",
    s = "s",
    t = "t",
    u = "u",
    v = "v",
    w = "w",
    x = "x",
    y = "y",
    z = "z",
    Meta = "Meta",
    ContextMenu = "ContextMenu",
    AudioVolumeMute = "AudioVolumeMute",
    AudioVolumeDown = "AudioVolumeDown",
    AudioVolumeUp = "AudioVolumeUp",
    F1 = "F1",
    F2 = "F2",
    F3 = "F3",
    F4 = "F4",
    F5 = "F5",
    F6 = "F6",
    F7 = "F7",
    F8 = "F8",
    F9 = "F9",
    F10 = "F10",
    F11 = "F11",
    F12 = "F12",
    NumLock = "NumLock",
    ScrollLock = "ScrollLock",
    Semicolon = ";",
    Equal = "=",
    Comma = ",",
    Minus = "-",
    Period = ".",
    Slash = "/",
    Backquote = "`",
    BracketLeft = "[",
    Backslash = "\\",
    BracketRight = "]",
    Quote = "'",
    Tilde = "~",
    Exclamation = "!",
    At = "@",
    Sharp = "#",
    Dollar = "$",
    Percent = "%",
    Caret = "^",
    Ampersand = "&",
    Asterisk = "*",
    ParenthesisLeft = "(",
    ParenthesisRight = ")",
    Underscore = "_",
    Plus = "+",
    OpenBrace = "{",
    CloseBrace = "}",
    Pipe = "|",
    Colon = ":",
    Quote2 = '"',
    AngleBracketLeft = "<",
    AngleBracketRight = ">",
    QuestionMark = "?"
  }

  /**
   * Codes for KeyboardEvent.code
   */
  export enum Codes {
    Backspace = "Backspace",
    Tab = "Tab",
    Enter = "Enter",
    ShiftLeft = "ShiftLeft",
    ShiftRight = "ShiftRight",
    ControlLeft = "ControlLeft",
    ControlRight = "ControlRight",
    AltLeft = "AltLeft",
    AltRight = "AltRight",
    Pause = "Pause",
    CapsLock = "CapsLock",
    Escape = "Escape",
    Space = "Space",
    PageUp = "PageUp",
    PageDown = "PageDown",
    End = "End",
    Home = "Home",
    ArrowLeft = "ArrowLeft",
    ArrowUp = "ArrowUp",
    ArrowRight = "ArrowRight",
    ArrowDown = "ArrowDown",
    PrintScreen = "PrintScreen",
    Insert = "Insert",
    Delete = "Delete",
    Digit0 = "Digit0",
    Digit1 = "Digit1",
    Digit2 = "Digit2",
    Digit3 = "Digit3",
    Digit4 = "Digit4",
    Digit5 = "Digit5",
    Digit6 = "Digit6",
    Digit7 = "Digit7",
    Digit8 = "Digit8",
    Digit9 = "Digit9",
    AudioVolumeMute = "AudioVolumeMute",
    AudioVolumeDown = "AudioVolumeDown",
    AudioVolumeUp = "AudioVolumeUp",
    KeyA = "KeyA",
    KeyB = "KeyB",
    KeyC = "KeyC",
    KeyD = "KeyD",
    KeyE = "KeyE",
    KeyF = "KeyF",
    KeyG = "KeyG",
    KeyH = "KeyH",
    KeyI = "KeyI",
    KeyJ = "KeyJ",
    KeyK = "KeyK",
    KeyL = "KeyL",
    KeyM = "KeyM",
    KeyN = "KeyN",
    KeyO = "KeyO",
    KeyP = "KeyP",
    KeyQ = "KeyQ",
    KeyR = "KeyR",
    KeyS = "KeyS",
    KeyT = "KeyT",
    KeyU = "KeyU",
    KeyV = "KeyV",
    KeyW = "KeyW",
    KeyX = "KeyX",
    KeyY = "KeyY",
    KeyZ = "KeyZ",
    MetaLeft = "MetaLeft",
    MetaRight = "MetaRight",
    ContextMenu = "ContextMenu",
    Numpad0 = "Numpad0",
    Numpad1 = "Numpad1",
    Numpad2 = "Numpad2",
    Numpad3 = "Numpad3",
    Numpad4 = "Numpad4",
    Numpad5 = "Numpad5",
    Numpad6 = "Numpad6",
    Numpad7 = "Numpad7",
    Numpad8 = "Numpad8",
    Numpad9 = "Numpad9",
    NumpadMultiply = "NumpadMultiply",
    NumpadAdd = "NumpadAdd",
    NumpadSubtract = "NumpadSubtract",
    NumpadDecimal = "NumpadDecimal",
    NumpadDivide = "NumpadDivide",
    F1 = "F1",
    F2 = "F2",
    F3 = "F3",
    F4 = "F4",
    F5 = "F5",
    F6 = "F6",
    F7 = "F7",
    F8 = "F8",
    F9 = "F9",
    F10 = "F10",
    F11 = "F11",
    F12 = "F12",
    NumLock = "NumLock",
    ScrollLock = "ScrollLock",
    Semicolon = "Semicolon",
    Equal = "Equal",
    Comma = "Comma",
    Minus = "Minus",
    Period = "Period",
    Slash = "Slash",
    Backquote = "Backquote",
    BracketLeft = "BracketLeft",
    Backslash = "Backslash",
    BracketRight = "BracketRight",
    Quote = "Quote"
  }

  /**
   * Is typing content or press command key
   * @param input Input key
   * @returns Result
   */
  export function isTypingContent(input: Keys | string) {
    return input.length === 1;
  }
}
