from typing import List
from amulet_map_editor.amulet_wx.util.key_config import (
    KeybindContainer,
    KeybindGroup,
    KeybindGroupIdType,
    KeyActionType,
    Space,
    Shift,
    MouseLeft,
    MouseRight,
    MouseWheelScrollUp,
    MouseWheelScrollDown,
    Control,
    Numpad_Add,
)


KeybindKeys: List[KeyActionType] = [
    "up",
    "down",
    "forwards",
    "backwards",
    "left",
    "right",
    "box click",
    "toggle mouse mode",
    "speed+",
    "speed-",
    "selection distance +",
    "selection distance -",
    "deselect boxes",
    "add box modifier",
    "remove box",
]


PresetKeybinds: KeybindContainer = {
    "right": {
        "up": ((), Space),
        "down": ((), Shift),
        "forwards": ((), "W"),
        "backwards": ((), "S"),
        "left": ((), "A"),
        "right": ((), "D"),
        "box click": ((), MouseLeft),
        "toggle mouse mode": ((), MouseRight),
        "speed+": ((), MouseWheelScrollUp),
        "speed-": ((), MouseWheelScrollDown),
        "selection distance +": ((), "R"),
        "selection distance -": ((), "F"),
        "deselect boxes": ((Control, Shift), "D"),
        "add box modifier": ((), Numpad_Add),
        "remove box": ((Control, ), "D"),
    },
    "right_laptop": {
        "up": ((), Space),
        "down": ((), Shift),
        "forwards": ((), "W"),
        "backwards": ((), "S"),
        "left": ((), "A"),
        "right": ((), "D"),
        "box click": ((), MouseLeft),
        "toggle mouse mode": ((), MouseRight),
        "speed+": ((), "."),
        "speed-": ((), ","),
        "selection distance +": ((), "R"),
        "selection distance -": ((), "F"),
        "deselect boxes": ((Control, Shift), "D"),
        "add box modifier": ((), Numpad_Add),
        "remove box": ((Control, ), "D"),
    },
    "left": {
        "up": ((), Space),
        "down": ((), ';'),
        "forwards": ((), "I"),
        "backwards": ((), "K"),
        "left": ((), "J"),
        "right": ((), "L"),
        "box click": ((), MouseLeft),
        "toggle mouse mode": ((), MouseRight),
        "speed+": ((), MouseWheelScrollUp),
        "speed-": ((), MouseWheelScrollDown),
        "selection distance +": ((), "Y"),
        "selection distance -": ((), "H"),
        "deselect boxes": ((Control, Shift), "D"),
        "add box modifier": ((), Numpad_Add),
        "remove box": ((Control, ), "D"),
    },
    "left_laptop": {
        "up": ((), Space),
        "down": ((), ';'),
        "forwards": ((), "I"),
        "backwards": ((), "K"),
        "left": ((), "J"),
        "right": ((), "L"),
        "box click": ((), MouseLeft),
        "toggle mouse mode": ((), MouseRight),
        "speed+": ((), "."),
        "speed-": ((), ","),
        "selection distance +": ((), "Y"),
        "selection distance -": ((), "H"),
        "deselect boxes": ((Control, Shift), "D"),
        "add box modifier": ((), Numpad_Add),
        "remove box": ((Control, ), "D"),
    }
}

DefaultKeybindGroupId: KeybindGroupIdType = "right"
DefaultKeys: KeybindGroup = PresetKeybinds[DefaultKeybindGroupId]
