#pragma once

#include "CoreMinimal.h"
#include "CoreBaseUserWidget.h"
#include "ReportPlayerDelegate.h"
#include "PlayerStatusDelegate.h"
#include "TallyPlayerStatusViewData.h"
#include "EPlayerCardAnimationMode.h"
#include "EGameType.h"
#include "CoreTallyPlayerStatusWidget.generated.h"

class UDBDTextBlock;
class UCoreMenuLoadoutPartWidget;
class UCoreMenuAddonWidget;
class UCoreMenuClassWidget;
class UHorizontalBox;
class UCoreMenuPerkWidget;
class UCoreIconToggleWidget;
class UDBDButton;
class UCoreButtonWidget;

UCLASS(Blueprintable, EditInlineNew)
class UCoreTallyPlayerStatusWidget : public UCoreBaseUserWidget
{
	GENERATED_BODY()

protected:
	UPROPERTY(EditAnywhere, BlueprintReadWrite, BlueprintCallable)
	FReportPlayerDelegate _onReportButtonClicked;

	UPROPERTY(EditAnywhere, BlueprintReadWrite, BlueprintCallable)
	FPlayerStatusDelegate _onPlayerStatusClicked;

	UPROPERTY(BlueprintReadWrite, meta=(BindWidgetOptional))
	UDBDTextBlock* CharacterNameTB;

	UPROPERTY(BlueprintReadWrite, meta=(BindWidgetOptional))
	UDBDTextBlock* AccountNameTB;

	UPROPERTY(BlueprintReadWrite, meta=(BindWidgetOptional))
	UDBDTextBlock* ScoreTB;

	UPROPERTY(BlueprintReadWrite, meta=(BindWidgetOptional))
	UDBDTextBlock* LoadoutBlockerTB;

	UPROPERTY(BlueprintReadWrite, meta=(BindWidgetOptional))
	UCoreMenuLoadoutPartWidget* CorePower;

	UPROPERTY(BlueprintReadWrite, meta=(BindWidgetOptional))
	UCoreMenuLoadoutPartWidget* CoreItem;

	UPROPERTY(BlueprintReadWrite, meta=(BindWidgetOptional))
	UCoreMenuAddonWidget* CoreAddon_1;

	UPROPERTY(BlueprintReadWrite, meta=(BindWidgetOptional))
	UCoreMenuAddonWidget* CoreAddon_2;

	UPROPERTY(BlueprintReadWrite, meta=(BindWidgetOptional))
	UCoreMenuLoadoutPartWidget* CoreOffering;

	UPROPERTY(BlueprintReadWrite, meta=(BindWidgetOptional))
	UCoreMenuClassWidget* CoreClass;

	UPROPERTY(BlueprintReadWrite, meta=(BindWidgetOptional))
	UHorizontalBox* PerksContainer;

	UPROPERTY(EditAnywhere, BlueprintReadWrite, Instanced)
	TArray<UCoreMenuPerkWidget*> PerkSlotWidgets;

	UPROPERTY(BlueprintReadWrite, meta=(BindWidgetOptional))
	UCoreIconToggleWidget* ReportButton;

	UPROPERTY(BlueprintReadWrite, meta=(BindWidgetOptional))
	UDBDButton* HoverzoneButton;

	UPROPERTY(BlueprintReadWrite, meta=(BindWidgetOptional))
	UDBDButton* HitzoneButton;

	UPROPERTY(EditAnywhere, BlueprintReadWrite)
	int32 MaxNameLength;

	UPROPERTY(EditAnywhere, BlueprintReadWrite)
	bool _isKillerLoadoutRevealed;

private:
	UPROPERTY(EditInstanceOnly, BlueprintReadWrite, Transient, Instanced, meta=(AllowPrivateAccess=true))
	TArray<UCoreMenuAddonWidget*> _addonSlotWidget;

	UPROPERTY(EditInstanceOnly, BlueprintReadWrite, Transient, meta=(AllowPrivateAccess=true))
	FTallyPlayerStatusViewData _tallyPlayerStatusViewData;

	UPROPERTY(EditInstanceOnly, BlueprintReadWrite, Transient, Instanced, meta=(AllowPrivateAccess=true))
	TArray<UCoreMenuLoadoutPartWidget*> _slotList;

private:
	UFUNCTION(BlueprintCallable)
	void ShowLoadoutTooltip(UCoreButtonWidget* hoveredSlotWidget);

public:
	UFUNCTION(BlueprintCallable, BlueprintNativeEvent)
	void SetReportButtonOpacity(const float opacity);

	UFUNCTION(BlueprintCallable)
	void SetPlayerCardAnimationMode(const EPlayerCardAnimationMode playerCardAnimationMode);

	UFUNCTION(BlueprintCallable, BlueprintImplementableEvent)
	void SetPlayerCardAnimation(const bool isAnimationPlaying);

	UFUNCTION(BlueprintCallable)
	void SetKillerLoadoutRevealed(bool isRevealed);

	UFUNCTION(BlueprintCallable, BlueprintNativeEvent)
	void SetKillerLoadoutBlocked(const bool isBlocked);

	UFUNCTION(BlueprintCallable, BlueprintNativeEvent)
	void SetData(const FTallyPlayerStatusViewData& viewData, EGameType gameType, bool isUsingCharacterClass);

	UFUNCTION(BlueprintCallable, BlueprintNativeEvent)
	void SetAsReported(const bool isReported);

private:
	UFUNCTION(BlueprintCallable)
	void OnReportButtonClicked(UCoreButtonWidget* buttonTarget);

	UFUNCTION(BlueprintCallable)
	void OnPlayerStatusUnhovered();

	UFUNCTION(BlueprintCallable)
	void OnPlayerStatusHovered();

	UFUNCTION(BlueprintCallable)
	void OnPlayerStatusClicked();

	UFUNCTION(BlueprintCallable)
	void HideLoadoutTooltip(UCoreButtonWidget* unhoveredSlotWidget);

public:
	UCoreTallyPlayerStatusWidget();
};

FORCEINLINE uint32 GetTypeHash(const UCoreTallyPlayerStatusWidget) { return 0; }
