#pragma once

#include "CoreMinimal.h"
#include "CoreSelectableButtonWidget.h"
#include "Layout/Margin.h"
#include "Templates/SubclassOf.h"
#include "ETooltipHorizontalAlignment.h"
#include "ETooltipVerticalAlignment.h"
#include "EFlagSize.h"
#include "CoreStoreItemWidget.generated.h"

class UCorePriceTagWidget;
class UCoreTimerFlagWidget;
class UScaleBox;
class UWidget;
class UCoreOnHoverBorderWidget;
class UVerticalBox;
class UGridPanel;
class UCorePreConstructableList;
class UStoreItemViewData;
class UCoreButtonWidget;

UCLASS(Blueprintable, Abstract, EditInlineNew)
class DBDUIVIEWSCORE_API UCoreStoreItemWidget : public UCoreSelectableButtonWidget
{
	GENERATED_BODY()

protected:
	UPROPERTY(EditAnywhere, BlueprintReadWrite)
	int32 _layoutMask;

	UPROPERTY(EditAnywhere, BlueprintReadWrite, NoClear)
	FMargin _priceTagPadding;

	UPROPERTY(EditAnywhere, BlueprintReadWrite, NoClear)
	FMargin _timerFlagPadding;

	UPROPERTY(EditAnywhere, BlueprintReadWrite, NoClear)
	TSubclassOf<UCorePriceTagWidget> _priceTagWidgetClass;

	UPROPERTY(EditAnywhere, BlueprintReadWrite, NoClear)
	TSubclassOf<UCoreTimerFlagWidget> _timerFlagWidgetClass;

	UPROPERTY(EditAnywhere, BlueprintReadWrite)
	int32 _preConstructedPriceTagCount;

	UPROPERTY(EditAnywhere, BlueprintReadWrite)
	int32 _preConstructedTimerFlagCount;

	UPROPERTY(EditAnywhere, BlueprintReadWrite)
	bool _showTooltipOnHover;

	UPROPERTY(EditAnywhere, BlueprintReadWrite)
	ETooltipHorizontalAlignment _tooltipHorizontalAlignment;

	UPROPERTY(EditAnywhere, BlueprintReadWrite)
	ETooltipVerticalAlignment _tooltipVerticalAlignment;

	UPROPERTY(EditAnywhere, BlueprintReadWrite, meta=(BindWidgetOptional))
	UScaleBox* LayoutScale;

	UPROPERTY(EditAnywhere, BlueprintReadWrite, meta=(BindWidgetOptional))
	UWidget* SelectedOverlay;

	UPROPERTY(EditAnywhere, BlueprintReadWrite, meta=(BindWidgetOptional))
	UCoreOnHoverBorderWidget* OnHoverBorder;

	UPROPERTY(EditAnywhere, BlueprintReadWrite, meta=(BindWidgetOptional))
	UVerticalBox* TimerFlagVerticalBox;

	UPROPERTY(EditAnywhere, BlueprintReadWrite, meta=(BindWidgetOptional))
	UGridPanel* PriceTagsContainer;

	UPROPERTY(EditAnywhere, BlueprintReadWrite, Transient)
	UCorePreConstructableList* _priceTagsList;

	UPROPERTY(EditAnywhere, BlueprintReadWrite, Transient)
	UCorePreConstructableList* _timerFlagsList;

	UPROPERTY(EditAnywhere, BlueprintReadWrite, Transient)
	EFlagSize _flagSize;

public:
	UFUNCTION(BlueprintCallable)
	void SetTimerFlagSize(EFlagSize flagSize);

	UFUNCTION(BlueprintCallable)
	void SetStoreItemLayout(int32 layoutMask);

	UFUNCTION(BlueprintCallable, BlueprintNativeEvent)
	void SetStoreItemData(UStoreItemViewData* data);

	UFUNCTION(BlueprintCallable)
	void SetShowTooltipOnHover(const bool showTooltipOnHover);

	UFUNCTION(BlueprintCallable)
	void SetScale(float scale);

	UFUNCTION(BlueprintCallable)
	void SetPriceTagScale(const float priceTagScale);

	UFUNCTION(BlueprintCallable, BlueprintImplementableEvent)
	void SetNotificationTag(const bool isNew);

protected:
	UFUNCTION(BlueprintCallable)
	void OnButtonUnhovered(UCoreButtonWidget* targetButton);

	UFUNCTION(BlueprintCallable)
	void OnButtonSelectedChanged(UCoreSelectableButtonWidget* targetButton, bool isSelected);

	UFUNCTION(BlueprintCallable)
	void OnButtonHovered(UCoreButtonWidget* targetButton);

	UFUNCTION(BlueprintPure)
	bool IsTagEnabled(const int32 layoutMask) const;

	UFUNCTION(BlueprintCallable)
	UCoreTimerFlagWidget* CreateTimerFlagWidget();

	UFUNCTION(BlueprintCallable)
	UCorePriceTagWidget* CreatePriceTagWidget();

	UFUNCTION(BlueprintCallable)
	void ClearTimerFlagWidgets();

	UFUNCTION(BlueprintCallable)
	void ClearPriceTagWidgets();

public:
	UFUNCTION(BlueprintCallable, BlueprintNativeEvent)
	void BindHoverBorder(const bool isInteractable);

public:
	UCoreStoreItemWidget();
};

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