extends Resource
class_name KeyBinding

@export var action_id: String = ""                            # 绑定到哪个动作
@export_enum("button", "axis_pair") var type: String = "button"

# 按钮型：用 key
@export var key: int = KEY_NONE                               # 例如 KEY_SPACE

# 轴型（成对键）：用 neg_key / pos_key
@export var neg_key: int = KEY_NONE                           # 例如 KEY_A
@export var pos_key: int = KEY_NONE                           # 例如 KEY_D

func is_valid() -> bool:
	if action_id == "":
		return false
	if type == "button":
		return key != KEY_NONE
	if type == "axis_pair":
		return neg_key != KEY_NONE or pos_key != KEY_NONE
	return false
