use crate::eventhooks::types::Key;
pub fn key_from_code(code: u32) -> Key {
match code {
0x08 => Key::Backspace,
0x09 => Key::Tab,
0x03 => Key::Cancel,
12 => Key::Clear,
13 => Key::Return,
19 => Key::Pause,
20 => Key::CapsLock,
0x15 => Key::Kana,
0x17 => Key::Junja,
0x18 => Key::Final,
0x19 => Key::Hanja,
27 => Key::Escape,
32 => Key::Space,
33 => Key::PageUp,
34 => Key::PageDown,
35 => Key::End,
36 => Key::Home,
37 => Key::LeftArrow,
38 => Key::UpArrow,
39 => Key::RightArrow,
40 => Key::DownArrow,
0x29 => Key::Select,
0x2A => Key::Print,
0x2B => Key::Execute,
44 => Key::PrintScreen,
45 => Key::Insert,
46 => Key::Delete,
0x2F => Key::Help,
48 => Key::Num0,
49 => Key::Num1,
50 => Key::Num2,
51 => Key::Num3,
52 => Key::Num4,
53 => Key::Num5,
54 => Key::Num6,
55 => Key::Num7,
56 => Key::Num8,
57 => Key::Num9,
65 => Key::KeyA,
66 => Key::KeyB,
67 => Key::KeyC,
68 => Key::KeyD,
69 => Key::KeyE,
70 => Key::KeyF,
71 => Key::KeyG,
72 => Key::KeyH,
73 => Key::KeyI,
74 => Key::KeyJ,
75 => Key::KeyK,
76 => Key::KeyL,
77 => Key::KeyM,
78 => Key::KeyN,
79 => Key::KeyO,
80 => Key::KeyP,
81 => Key::KeyQ,
82 => Key::KeyR,
83 => Key::KeyS,
84 => Key::KeyT,
85 => Key::KeyU,
86 => Key::KeyV,
87 => Key::KeyW,
88 => Key::KeyX,
89 => Key::KeyY,
90 => Key::KeyZ,
91 => Key::MetaLeft,
92 => Key::MetaRight,
93 => Key::Apps,
0x5F => Key::Sleep,
96 => Key::Kp0,
97 => Key::Kp1,
98 => Key::Kp2,
99 => Key::Kp3,
100 => Key::Kp4,
101 => Key::Kp5,
102 => Key::Kp6,
103 => Key::Kp7,
104 => Key::Kp8,
105 => Key::Kp9,
106 => Key::KpMultiply,
107 => Key::KpPlus,
0x6C => Key::Separator,
109 => Key::KpMinus,
110 => Key::KpDecimal,
111 => Key::KpDivide,
112 => Key::F1,
113 => Key::F2,
114 => Key::F3,
115 => Key::F4,
116 => Key::F5,
117 => Key::F6,
118 => Key::F7,
119 => Key::F8,
120 => Key::F9,
121 => Key::F10,
122 => Key::F11,
123 => Key::F12,
0x7C => Key::F13,
0x7D => Key::F14,
0x7E => Key::F15,
0x7F => Key::F16,
0x80 => Key::F17,
0x81 => Key::F18,
0x82 => Key::F19,
0x83 => Key::F20,
0x84 => Key::F21,
0x85 => Key::F22,
0x86 => Key::F23,
0x87 => Key::F24,
144 => Key::NumLock,
145 => Key::ScrollLock,
160 => Key::ShiftLeft,
161 => Key::ShiftRight,
162 => Key::ControlLeft,
163 => Key::ControlRight,
164 => Key::Alt,
165 => Key::AltGr,
186 => Key::SemiColon,
187 => Key::Equal,
188 => Key::Comma,
189 => Key::Minus,
190 => Key::Dot,
191 => Key::Slash,
192 => Key::BackQuote,
219 => Key::LeftBracket,
220 => Key::BackSlash,
221 => Key::RightBracket,
222 => Key::Quote,
226 => Key::IntlBackslash,
0x00E2 => Key::IntlRo,
0x00DC => Key::IntlYen,
0x00AF => Key::VolumeUp,
0x00AE => Key::VolumeDown,
0x00AD => Key::VolumeMute,
0x1C => Key::Lang2,
0x1D => Key::Lang1,
_ => Key::Unknown(code),
}
}