#pragma once

#include <Core/HAL/Keyboard/ScanCode.h>

namespace Juliet::Win32
{
    // Conversion table from Win32 scan code to HID Usage Page (see Keyboard.h)
    // https://learn.microsoft.com/en-us/windows/win32/inputdev/about-keyboard-input#extended-key-flag
    // clang-format off
    static constexpr ScanCode Win32ToHIDUsagePageTable[] = {
        ScanCode::Unknown,             // 0x00
        ScanCode::Escape,              // 0x01
        ScanCode::Num1,                // 0x02
        ScanCode::Num2,                // 0x03
        ScanCode::Num3,                // 0x04
        ScanCode::Num4,                // 0x05
        ScanCode::Num5,                // 0x06
        ScanCode::Num6,                // 0x07
        ScanCode::Num7,                // 0x08
        ScanCode::Num8,                // 0x09
        ScanCode::Num9,                // 0x0A
        ScanCode::Num0,                // 0x0B
        ScanCode::Minus,               // 0x0C
        ScanCode::Equals,              // 0x0D
        ScanCode::Backspace,           // 0x0E
        ScanCode::Tab,                 // 0x0F
        ScanCode::Q,                   // 0x10
        ScanCode::W,                   // 0x11
        ScanCode::E,                   // 0x12
        ScanCode::R,                   // 0x13
        ScanCode::T,                   // 0x14
        ScanCode::Y,                   // 0x15
        ScanCode::U,                   // 0x16
        ScanCode::I,                   // 0x17
        ScanCode::O,                   // 0x18
        ScanCode::P,                   // 0x19
        ScanCode::LeftBracket,         // 0x1A
        ScanCode::RightBracket,        // 0x1B
        ScanCode::Return,              // 0x1C
        ScanCode::LeftControl,         // 0x1D
        ScanCode::A,                   // 0x1E
        ScanCode::S,                   // 0x1F
        ScanCode::D,                   // 0x20
        ScanCode::F,                   // 0x21
        ScanCode::G,                   // 0x22
        ScanCode::H,                   // 0x23
        ScanCode::J,                   // 0x24
        ScanCode::K,                   // 0x25
        ScanCode::L,                   // 0x26
        ScanCode::Semicolon,           // 0x27
        ScanCode::Apostrophe,          // 0x28
        ScanCode::GraveAccent,         // 0x29
        ScanCode::LeftShift,           // 0x2A
        ScanCode::Backslash,           // 0x2B
        ScanCode::Z,                   // 0x2C
        ScanCode::X,                   // 0x2D
        ScanCode::C,                   // 0x2E
        ScanCode::V,                   // 0x2F
        ScanCode::B,                   // 0x30
        ScanCode::N,                   // 0x31
        ScanCode::M,                   // 0x32
        ScanCode::Comma,               // 0x33
        ScanCode::Period,              // 0x34
        ScanCode::Slash,               // 0x35
        ScanCode::RightShift,          // 0x36
        ScanCode::KeyPad_Multiply,     // 0x37
        ScanCode::LeftAlt,             // 0x38
        ScanCode::Space,               // 0x39
        ScanCode::CapsLock,            // 0x3A
        ScanCode::F1,                  // 0x3B
        ScanCode::F2,                  // 0x3C
        ScanCode::F3,                  // 0x3D
        ScanCode::F4,                  // 0x3E
        ScanCode::F5,                  // 0x3F
        ScanCode::F6,                  // 0x40
        ScanCode::F7,                  // 0x41
        ScanCode::F8,                  // 0x42
        ScanCode::F9,                  // 0x43
        ScanCode::F10,                 // 0x44
        ScanCode::NumlockClear,        // 0x45
        ScanCode::ScrollLock,          // 0x46
        ScanCode::KeyPad_Num7,         // 0x47
        ScanCode::KeyPad_Num8,         // 0x48
        ScanCode::KeyPad_Num9,         // 0x49
        ScanCode::KeyPad_Minus,        // 0x4A
        ScanCode::KeyPad_Num4,         // 0x4B
        ScanCode::KeyPad_Num5,         // 0x4C
        ScanCode::KeyPad_Num6,         // 0x4D
        ScanCode::KeyPad_Plus,         // 0x4E
        ScanCode::KeyPad_Num1,         // 0x4F
        ScanCode::KeyPad_Num2,         // 0x50
        ScanCode::KeyPad_Num3,         // 0x51
        ScanCode::KeyPad_Num0,         // 0x52
        ScanCode::KeyPad_Period,       // 0x53
        ScanCode::Unknown,             // 0x54
        ScanCode::Unknown,             // 0x55
        ScanCode::NonUSBackslash,      // 0x56
        ScanCode::F11,                 // 0x57
        ScanCode::F12,                 // 0x58
        ScanCode::KeyPad_Equals,       // 0x59
        ScanCode::Unknown,             // 0x5A
        ScanCode::Unknown,             // 0x5B
        ScanCode::International6,      // 0x5C
        ScanCode::Unknown,             // 0x5D
        ScanCode::Unknown,             // 0x5E
        ScanCode::Unknown,             // 0x5F
        ScanCode::Unknown,             // 0x60
        ScanCode::Unknown,             // 0x61
        ScanCode::Unknown,             // 0x62
        ScanCode::Unknown,             // 0x63
        ScanCode::F13,                 // 0x64
        ScanCode::F14,                 // 0x65
        ScanCode::F15,                 // 0x66
        ScanCode::F16,                 // 0x67
        ScanCode::F17,                 // 0x68
        ScanCode::F18,                 // 0x69
        ScanCode::F19,                 // 0x6A
        ScanCode::F20,                 // 0x6B
        ScanCode::F21,                 // 0x6C
        ScanCode::F22,                 // 0x6D
        ScanCode::F23,                 // 0x6E
        ScanCode::Unknown,             // 0x6F
        ScanCode::International2,      // 0x70
        ScanCode::Lang2,               // 0x71
        ScanCode::Lang1,               // 0x72
        ScanCode::International1,      // 0x73
        ScanCode::Unknown,             // 0x74
        ScanCode::Unknown,             // 0x75
        ScanCode::F24,                 // 0x76
        ScanCode::Lang4,               // 0x77
        ScanCode::Lang3,               // 0x78
        ScanCode::International4,      // 0x79
        ScanCode::Unknown,             // 0x7A
        ScanCode::International5,      // 0x7B
        ScanCode::Unknown,             // 0x7C
        ScanCode::International3,      // 0x7D
        ScanCode::KeyPad_Comma,        // 0x7E
        ScanCode::Unknown,             // 0x7F
        ScanCode::Unknown,             // 0xe000
        ScanCode::Unknown,             // 0xe001
        ScanCode::Unknown,             // 0xe002
        ScanCode::Unknown,             // 0xe003
        ScanCode::Unknown,             // 0xe004
        ScanCode::Unknown,             // 0xe005
        ScanCode::Unknown,             // 0xe006
        ScanCode::Unknown,             // 0xe007
        ScanCode::Unknown,             // 0xe008
        ScanCode::Unknown,             // 0xe009
        ScanCode::Unsupported,         // 0xe00A Unsupported Application Paste
        ScanCode::Unknown,             // 0xe00B
        ScanCode::Unknown,             // 0xe00C
        ScanCode::Unknown,             // 0xe00D
        ScanCode::Unknown,             // 0xe00E
        ScanCode::Unknown,             // 0xe00F
        ScanCode::Media_PreviousTrack, // 0xe010
        ScanCode::Unknown,             // 0xe011
        ScanCode::Unknown,             // 0xe012
        ScanCode::Unknown,             // 0xe013
        ScanCode::Unknown,             // 0xe014
        ScanCode::Unknown,             // 0xe015
        ScanCode::Unknown,             // 0xe016
        ScanCode::Unsupported,         // 0xe017 Unsupported Application Cut
        ScanCode::Unsupported,         // 0xe018 Unsupported Application Copy
        ScanCode::Media_NextTrack,     // 0xe019
        ScanCode::Unknown,             // 0xe01A
        ScanCode::Unknown,             // 0xe01B
        ScanCode::KeyPad_Enter,        // 0xe01C
        ScanCode::RightControl,        // 0xe01D
        ScanCode::Unknown,             // 0xe01E
        ScanCode::Unknown,             // 0xe01F
        ScanCode::Mute,                // 0xe020
        ScanCode::Unsupported,         // 0xe021 // Unsupported LaunchApp2
        ScanCode::Media_PlayPause,     // 0xe022
        ScanCode::Unknown,             // 0xe023
        ScanCode::Media_Stop,          // 0xe024
        ScanCode::Unknown,             // 0xe025
        ScanCode::Unknown,             // 0xe026
        ScanCode::Unknown,             // 0xe027
        ScanCode::Unknown,             // 0xe028
        ScanCode::Unknown,             // 0xe029
        ScanCode::Unknown,             // 0xe02A
        ScanCode::Unknown,             // 0xe02B
        ScanCode::Media_Eject,         // 0xe02C
        ScanCode::Unknown,             // 0xe02D
        ScanCode::VolumeDown,          // 0xe02E
        ScanCode::Unknown,             // 0xe02F
        ScanCode::VolumeUp,            // 0xe030
        ScanCode::Unknown,             // 0xe031
        ScanCode::Unsupported,         // 0xe032 Unsupported Application Home
        ScanCode::Unknown,             // 0xe033
        ScanCode::Unknown,             // 0xe034
        ScanCode::KeyPad_Divide,       // 0xe035
        ScanCode::Unknown,             // 0xe036
        ScanCode::PrintScreen,         // 0xe037
        ScanCode::RightAlt,            // 0xe038
        ScanCode::Unknown,             // 0xe039
        ScanCode::Unknown,             // 0xe03A
        ScanCode::Unsupported,         // 0xe03B Unsupported Application Help
        ScanCode::Unknown,             // 0xe03C
        ScanCode::Unknown,             // 0xe03D
        ScanCode::Unknown,             // 0xe03E
        ScanCode::Unknown,             // 0xe03F
        ScanCode::Unknown,             // 0xe040
        ScanCode::Unknown,             // 0xe041
        ScanCode::Unknown,             // 0xe042
        ScanCode::Unknown,             // 0xe043
        ScanCode::Unknown,             // 0xe044
        ScanCode::NumlockClear,        // 0xe045
        ScanCode::Pause,               // 0xe046
        ScanCode::Home,                // 0xe047
        ScanCode::UpArrow,             // 0xe048
        ScanCode::PageUp,              // 0xe049
        ScanCode::Unknown,             // 0xe04A
        ScanCode::LeftArrow,           // 0xe04B
        ScanCode::Unknown,             // 0xe04C
        ScanCode::RightArrow,          // 0xe04D
        ScanCode::Unknown,             // 0xe04E
        ScanCode::End,                 // 0xe04F
        ScanCode::DownArrow,           // 0xe050
        ScanCode::PageDown,            // 0xe051
        ScanCode::Insert,              // 0xe052
        ScanCode::Delete,              // 0xe053
        ScanCode::Unknown,             // 0xe054
        ScanCode::Unknown,             // 0xe055
        ScanCode::Unknown,             // 0xe056
        ScanCode::Unknown,             // 0xe057
        ScanCode::Unknown,             // 0xe058
        ScanCode::Unknown,             // 0xe059
        ScanCode::Unknown,             // 0xe05A
        ScanCode::LeftOSCommand,       // 0xe05B
        ScanCode::RightOSCommand,      // 0xe05C
        ScanCode::Unsupported,         // 0xe05D Unsupported Application context
        ScanCode::Power,               // 0xe05E
        ScanCode::Sleep,               // 0xe05F
        ScanCode::Unknown,             // 0xe060
        ScanCode::Unknown,             // 0xe061
        ScanCode::Unknown,             // 0xe062
        ScanCode::Unknown,             // 0xe063
        ScanCode::Unknown,             // 0xe064
        ScanCode::Unsupported,         // 0xe065 Unsupported:Application Search
        ScanCode::Unsupported,         // 0xe066 Unsupported:Application Bookmarks
        ScanCode::Unsupported,         // 0xe067 Unsupported:Application Refresh
        ScanCode::Unsupported,         // 0xe068 Unsupported:Application Stop
        ScanCode::Unsupported,         // 0xe069 Unsupported:Application Forward
        ScanCode::Unsupported,         // 0xe06A Unsupported:Application Back
        ScanCode::Unsupported,         // 0xe06B Unsupported:LaunchApp1
        ScanCode::Unsupported,         // 0xe06C Unsupported:LaunchMail
        ScanCode::Media_Select,        // 0xe06D
        ScanCode::Unknown,             // 0xe06E
        ScanCode::Unknown,             // 0xe06F
        ScanCode::Unknown,             // 0xe070
        ScanCode::Unknown,             // 0xe071
        ScanCode::Unknown,             // 0xe072
        ScanCode::Unknown,             // 0xe073
        ScanCode::Unknown,             // 0xe074
        ScanCode::Unknown,             // 0xe075
        ScanCode::Unknown,             // 0xe076
        ScanCode::Unknown,             // 0xe077
        ScanCode::Unknown,             // 0xe078
        ScanCode::Unknown,             // 0xe079
        ScanCode::Unknown,             // 0xe07A
        ScanCode::Unknown,             // 0xe07B
        ScanCode::Unknown,             // 0xe07C
        ScanCode::Unknown,             // 0xe07D
        ScanCode::Unknown,             // 0xe07E
        ScanCode::Unknown              // 0xe07F

    };
    // clang-format on
} // namespace Juliet::Win32
