// Project Lab - NHTV Igad

#pragma once

#include "Blueprint/UserWidget.h"
#include "ButtonBarSwitcher.generated.h"

UCLASS()
class UNREALPROJECT_API UButtonBar : public UUserWidget
{
	GENERATED_BODY()
public:
	virtual void NativeConstruct() override;

	bool AssignSkillButton(const struct FIngameSkillTreeSkill& skill, class UAbilityButton*& buttonOut, bool alt);

	void SetGlobalEnable(bool enabled);

	UPROPERTY()
	TArray<class UAbilityButton*> buttons;
};

UCLASS()
class UNREALPROJECT_API UButtonBarSwitcher : public UUserWidget
{
	GENERATED_BODY()
public:
	virtual void NativeConstruct() override;

	bool AssignSkillButton(const struct FIngameSkillTreeSkill& skill, bool isAlt);
	void UpdateCooldowns(TArray<class AAbilityState*> abilityStates, class ANetworkPlayer* player);

	void SetSkillButtonEnabled(const struct FIngameSkillTreeSkill& skill, bool enabled);

	// Set the global enabled button state
	void SetGlobalEnable(bool enabled);

	class UAbilityInfo* GetAbilityMapping(int32 index);
	class UAbilityInfo* GetAbilityMapping(int32 index, bool isAlt);

	UFUNCTION(BlueprintNativeEvent, Category="Animation")
	void TransitionToAlternateSkillSet();
	UFUNCTION(BlueprintNativeEvent, Category="Animation")
	void TransitionToMainSkillSet();

	void ToggleSkillSet(bool useAlternateSkillSet);

private:
	UButtonBar* m_FindAndAddButtonBar(const FName& name);

	bool m_globalEnable;
	bool m_alternateSkillSet;

	UPROPERTY()
	TArray<UButtonBar*> m_buttonBars;
	UPROPERTY()
	TMap<class UAbilityInfo*, UAbilityButton*> m_mappedButtons;
};
