import { DEFAULT_CONTROLLER_GLYPHS } from "../input/controllerGlyphs";
import type { AbilitySlotId } from "./types";

interface AbilityControllerBinding {
  buttonIndex: number;
  glyph: string;
}

export const ABILITY_CONTROLLER_BINDINGS: Record<AbilitySlotId, AbilityControllerBinding> = {
  ability1: { buttonIndex: 2, glyph: DEFAULT_CONTROLLER_GLYPHS.faceLeft },
  ability2: { buttonIndex: 3, glyph: DEFAULT_CONTROLLER_GLYPHS.faceTop },
  ability3: { buttonIndex: 1, glyph: DEFAULT_CONTROLLER_GLYPHS.faceRight },
  ability4: { buttonIndex: 0, glyph: DEFAULT_CONTROLLER_GLYPHS.faceBottom },
  ability5: { buttonIndex: 4, glyph: DEFAULT_CONTROLLER_GLYPHS.leftShoulder },
  ability6: { buttonIndex: 5, glyph: DEFAULT_CONTROLLER_GLYPHS.rightShoulder },
};

export const ABILITY_BY_CONTROLLER_BUTTON = Object.fromEntries(
  Object.entries(ABILITY_CONTROLLER_BINDINGS).map(([abilityId, binding]) => [binding.buttonIndex, abilityId]),
) as Partial<Record<number, AbilitySlotId>>;
