#pragma once

#include "CoreMinimal.h"
#include "CoreBaseUserWidget.h"
#include "TimerFlagViewData.h"
#include "EFlagSize.h"
#include "CoreTimerFlagWidget.generated.h"

class UDBDTextBlock;
class UCoreButtonWidget;

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

protected:
	UPROPERTY(EditAnywhere, BlueprintReadWrite, meta=(BindWidgetOptional))
	UDBDTextBlock* TimerTB;

private:
	UPROPERTY(EditAnywhere, BlueprintReadWrite, meta=(AllowPrivateAccess=true))
	FTimerFlagViewData _cachedData;

	UPROPERTY(EditAnywhere, BlueprintReadWrite, meta=(AllowPrivateAccess=true))
	EFlagSize _currentFlagSize;

	UPROPERTY(EditAnywhere, BlueprintReadWrite, Transient, Export, meta=(AllowPrivateAccess=true))
	UCoreButtonWidget* _targetButton;

public:
	UFUNCTION(BlueprintCallable, BlueprintNativeEvent)
	void UpdateTimer(const FString& newTimer);

	UFUNCTION(BlueprintCallable, BlueprintNativeEvent)
	void UpdateFlagSize(EFlagSize flagSize);

	UFUNCTION(BlueprintCallable)
	void UnbindFromButton();

	UFUNCTION(BlueprintCallable, BlueprintNativeEvent)
	void SetData(const FTimerFlagViewData& data);

protected:
	UFUNCTION(BlueprintCallable)
	void OnTimerTick(int32 remainingTime);

private:
	UFUNCTION(BlueprintCallable)
	void OnTargetUnhovered(UCoreButtonWidget* targetButton);

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

public:
	UFUNCTION(BlueprintCallable)
	void NativeDestruct();

	UFUNCTION(BlueprintPure)
	bool IsDataSet() const;

protected:
	UFUNCTION(BlueprintPure)
	EFlagSize GetCurrentFlagSize() const;

	UFUNCTION(BlueprintPure)
	FTimerFlagViewData GetCachedData() const;

public:
	UFUNCTION(BlueprintCallable)
	void BindToButton(UCoreButtonWidget* targetButton);

public:
	UCoreTimerFlagWidget();
};

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