import type { KeyMap } from './types';

// Actions that can be bound
export const ACTIONS = [
    { id: 'A', label: 'A Button' },
    { id: 'B', label: 'B Button' },
    { id: 'X', label: 'X Button' },
    { id: 'Y', label: 'Y Button' },
    { id: 'PLUS', label: 'Plus (+)' },
    { id: 'MINUS', label: 'Minus (-)' },
    { id: 'HOME', label: 'Home' },
    { id: 'CAPTURE', label: 'Capture' },
    { id: 'L', label: 'L Trigger' },
    { id: 'ZL', label: 'ZL Trigger' },
    { id: 'R', label: 'R Trigger' },
    { id: 'ZR', label: 'ZR Trigger' },
    { id: 'DPAD_UP', label: 'D-Pad Up' },
    { id: 'DPAD_DOWN', label: 'D-Pad Down' },
    { id: 'DPAD_LEFT', label: 'D-Pad Left' },
    { id: 'DPAD_RIGHT', label: 'D-Pad Right' },
    { id: 'L_STICK_PRESS', label: 'L Stick Press' },
    { id: 'R_STICK_PRESS', label: 'R Stick Press' },
    { id: 'L_STICK_UP', label: 'L Stick Up' },
    { id: 'L_STICK_DOWN', label: 'L Stick Down' },
    { id: 'L_STICK_LEFT', label: 'L Stick Left' },
    { id: 'L_STICK_RIGHT', label: 'L Stick Right' },
    { id: 'R_STICK_UP', label: 'R Stick Up' },
    { id: 'R_STICK_DOWN', label: 'R Stick Down' },
    { id: 'R_STICK_LEFT', label: 'R Stick Left' },
    { id: 'R_STICK_RIGHT', label: 'R Stick Right' },
    { id: 'RECORD_MACRO', label: 'Start/Stop Macro Record' },
];

export const DEFAULT_KEYBINDS: KeyMap = {
    keyboard: {
        'A': 'KeyL',
        'B': 'KeyK',
        'X': 'KeyI',
        'Y': 'KeyJ',
        'PLUS': 'Digit6',
        'MINUS': 'Digit7',
        'HOME': 'BracketLeft',
        'CAPTURE': 'BracketRight',
        'L': 'Digit1',
        'ZL': 'Digit2',
        'R': 'Digit8',
        'ZR': 'Digit9',
        'DPAD_UP': 'KeyG',
        'DPAD_DOWN': 'KeyN',
        'DPAD_LEFT': 'KeyV',
        'DPAD_RIGHT': 'KeyB',
        'L_STICK_PRESS': 'KeyT',
        'R_STICK_PRESS': 'KeyY',
        'L_STICK_UP': 'KeyW',
        'L_STICK_DOWN': 'KeyS',
        'L_STICK_LEFT': 'KeyA',
        'L_STICK_RIGHT': 'KeyD',
        'R_STICK_UP': 'ArrowUp',
        'R_STICK_DOWN': 'ArrowDown',
        'R_STICK_LEFT': 'ArrowLeft',
        'R_STICK_RIGHT': 'ArrowRight',
        'RECORD_MACRO': 'KeyR',
    },
    gamepad: {
        buttons: { // Standard Gamepad Mapping
            'B': 0, 'A': 1, 'Y': 2, 'X': 3,
            'L': 4, 'R': 5, 'ZL': 6, 'ZR': 7,
            'MINUS': 8, 'PLUS': 9,
            'L_STICK_PRESS': 10, 'R_STICK_PRESS': 11,
            'DPAD_UP': 12, 'DPAD_DOWN': 13, 'DPAD_LEFT': 14, 'DPAD_RIGHT': 15,
            'HOME': 16,
        },
        axes: {
            'L_STICK_LEFT': { index: 0, direction: -1 },
            'L_STICK_RIGHT': { index: 0, direction: 1 },
            'L_STICK_UP': { index: 1, direction: -1 },
            'L_STICK_DOWN': { index: 1, direction: 1 },
            'R_STICK_LEFT': { index: 2, direction: -1 },
            'R_STICK_RIGHT': { index: 2, direction: 1 },
            'R_STICK_UP': { index: 3, direction: -1 },
            'R_STICK_DOWN': { index: 3, direction: 1 },
        }
    }
};
