#pragma once

#include "CoreMinimal.h"
#include "CoreSelectableButtonWidget.h"
#include "Templates/SubclassOf.h"
#include "Layout/Margin.h"
#include "EFlagSize.h"
#include "StoreContentViewData.h"
#include "TimerFlagViewData.h"
#include "PriceTagViewData.h"
#include "CoreStoreFeaturedCustomizationItemWidget.generated.h"

class UCorePriceTagWidget;
class UCoreTimerFlagWidget;
class UHorizontalBox;
class UVerticalBox;
class UCoreOnHoverBorderWidget;
class UCoreOwnedTagWidget;
class UDBDImage;
class UDBDTextBlock;
class UPanelWidget;
class UCorePreConstructableList;
class UUITweenInstance;
class UTextureLoadingWrapper;
class UStoreCustomizationItemViewData;
class UStoreChapterPackViewData;

UCLASS(Blueprintable, EditInlineNew)
class UCoreStoreFeaturedCustomizationItemWidget : public UCoreSelectableButtonWidget
{
	GENERATED_BODY()

protected:
	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, NoClear)
	FMargin _timerFlagPadding;

	UPROPERTY(EditAnywhere, BlueprintReadWrite, NoClear)
	FMargin _priceTagPadding;

	UPROPERTY(EditAnywhere, BlueprintReadWrite, NoClear)
	float _timerFlagScale;

	UPROPERTY(EditAnywhere, BlueprintReadWrite, NoClear)
	EFlagSize _timerFlagSize;

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

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

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

	UPROPERTY(EditAnywhere, BlueprintReadWrite, meta=(BindWidgetOptional))
	UCoreOwnedTagWidget* OwnedTag;

	UPROPERTY(EditAnywhere, BlueprintReadWrite, meta=(BindWidgetOptional))
	UDBDImage* RarityIMG;

	UPROPERTY(EditAnywhere, BlueprintReadWrite, meta=(BindWidgetOptional))
	UDBDTextBlock* RarityTB;

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

	UPROPERTY(EditAnywhere, BlueprintReadWrite, meta=(BindWidgetOptional))
	UDBDTextBlock* TitleTB;

	UPROPERTY(EditAnywhere, BlueprintReadWrite, meta=(BindWidgetOptional))
	UDBDTextBlock* OwnedCountTB;

	UPROPERTY(EditAnywhere, BlueprintReadWrite, meta=(BindWidgetOptional))
	UDBDImage* BundleIMG;

	UPROPERTY(EditAnywhere, BlueprintReadWrite, meta=(BindWidgetOptional))
	UDBDImage* VisceralOverlay;

	UPROPERTY(EditAnywhere, BlueprintReadWrite, meta=(BindWidgetOptional))
	UPanelWidget* Footer;

	UPROPERTY(EditAnywhere, BlueprintReadWrite, meta=(BindWidgetOptional))
	UPanelWidget* DetailPanel;

	UPROPERTY(EditAnywhere, BlueprintReadWrite, meta=(BindWidgetOptional))
	UDBDImage* ItemIcon;

	UPROPERTY(EditAnywhere, BlueprintReadWrite, Transient)
	FStoreContentViewData _cachedData;

private:
	UPROPERTY(EditAnywhere, BlueprintReadWrite, Transient, meta=(AllowPrivateAccess=true))
	UCorePreConstructableList* _priceTagsList;

	UPROPERTY(EditAnywhere, BlueprintReadWrite, Transient, meta=(AllowPrivateAccess=true))
	UCorePreConstructableList* _timerFlagsList;

	UPROPERTY(EditAnywhere, BlueprintReadWrite, Transient, meta=(AllowPrivateAccess=true))
	UUITweenInstance* _sizeTween;

	UPROPERTY(EditAnywhere, BlueprintReadWrite, Transient, meta=(AllowPrivateAccess=true))
	UUITweenInstance* _positionTween;

	UPROPERTY(EditAnywhere, BlueprintReadWrite, Transient, meta=(AllowPrivateAccess=true))
	UUITweenInstance* _onHoverBorderTween;

	UPROPERTY(EditAnywhere, BlueprintReadWrite, Transient, meta=(AllowPrivateAccess=true))
	UTextureLoadingWrapper* _imageLoader;

private:
	UFUNCTION(BlueprintCallable)
	void UpdateSizeCompleted(UUITweenInstance* tween);

	UFUNCTION(BlueprintCallable)
	void UpdateSize(UUITweenInstance* tween);

	UFUNCTION(BlueprintCallable)
	void UpdatePosition(UUITweenInstance* tween);

	UFUNCTION(BlueprintCallable)
	void UpdateOnHoverBorder(UUITweenInstance* tween);

protected:
	UFUNCTION(BlueprintCallable)
	UCoreTimerFlagWidget* ShowTimerFlagWidget(const FTimerFlagViewData& timerFlagData);

	UFUNCTION(BlueprintCallable)
	void SetTimerFlags(const FTimerFlagViewData& limitedTimeFlag, const FTimerFlagViewData& discountTimeFlag, const bool isOwned);

	UFUNCTION(BlueprintCallable, BlueprintImplementableEvent)
	void SetPriceTags(const bool isBuyable, const TArray<FPriceTagViewData>& priceTags);

public:
	UFUNCTION(BlueprintCallable)
	void SetOwnedTagVisibility(const bool isVisible);

	UFUNCTION(BlueprintCallable, BlueprintNativeEvent)
	void SetCustomizationData(UStoreCustomizationItemViewData* customizationItemViewData);

	UFUNCTION(BlueprintCallable, BlueprintNativeEvent)
	void SetChapterPackData(UStoreChapterPackViewData* chapterPackViewData);

private:
	UFUNCTION(BlueprintCallable)
	void OnSelectedItemChanged(UCoreSelectableButtonWidget* buttonTarget, bool isSelected);

protected:
	UFUNCTION(BlueprintCallable)
	UCorePriceTagWidget* CreatePriceTagWidget();

	UFUNCTION(BlueprintCallable)
	void ClearTimerFlagWidgets();

	UFUNCTION(BlueprintCallable)
	void ClearPriceTagWidgets();

public:
	UCoreStoreFeaturedCustomizationItemWidget();
};

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