#pragma once

#include "CoreMinimal.h"
#include "AlertsViewInterface.h"
#include "CoreBaseUserWidget.h"
#include "Templates/SubclassOf.h"
#include "ETooltipHorizontalAlignment.h"
#include "ETooltipVerticalAlignment.h"
#include "RewardWrapperViewData.h"
#include "ChallengeTrackerViewData.h"
#include "ChallengeViewData.h"
#include "AlertsViewData.h"
#include "CoreAlertsWidget.generated.h"

class UCoreRewardWrapperWidget;
class UHorizontalBox;
class UDBDImage;
class UDBDTextBlock;
class UCoreInputSwitcherWidget;
class UAkAudioEvent;
class UCoreButtonWidget;

UCLASS(Blueprintable, EditInlineNew)
class DBDUIVIEWSCORE_API UCoreAlertsWidget : public UCoreBaseUserWidget, public IAlertsViewInterface
{
	GENERATED_BODY()

public:
	UPROPERTY(EditAnywhere, BlueprintReadWrite)
	TSubclassOf<UCoreRewardWrapperWidget> RewardWidgetClass;

	UPROPERTY(EditAnywhere, BlueprintReadWrite, Export)
	UHorizontalBox* Container;

	UPROPERTY(EditAnywhere, BlueprintReadWrite, Export)
	UDBDImage* BackgroundImage;

	UPROPERTY(EditAnywhere, BlueprintReadWrite, Export)
	UDBDTextBlock* RewardClaimedText;

	UPROPERTY(EditAnywhere, BlueprintReadWrite, Export)
	UDBDTextBlock* NumberRewardsText;

	UPROPERTY(EditAnywhere, BlueprintReadWrite, Export)
	UCoreInputSwitcherWidget* SkipButton;

	UPROPERTY(EditAnywhere, BlueprintReadWrite)
	ETooltipHorizontalAlignment HorizontalAlignment;

	UPROPERTY(EditAnywhere, BlueprintReadWrite)
	ETooltipVerticalAlignment VerticalAlignment;

	UPROPERTY(EditAnywhere, BlueprintReadWrite)
	UAkAudioEvent* SoundEffectCurrency;

	UPROPERTY(EditAnywhere, BlueprintReadWrite)
	UAkAudioEvent* SoundEffectCommon;

	UPROPERTY(EditAnywhere, BlueprintReadWrite)
	UAkAudioEvent* SoundEffectUncommon;

	UPROPERTY(EditAnywhere, BlueprintReadWrite)
	UAkAudioEvent* SoundEffectRare;

	UPROPERTY(EditAnywhere, BlueprintReadWrite)
	UAkAudioEvent* SoundEffectVeryRare;

	UPROPERTY(EditAnywhere, BlueprintReadWrite)
	UAkAudioEvent* SoundEffectUltraRare;

	UPROPERTY(EditAnywhere, BlueprintReadWrite)
	UAkAudioEvent* SoundEffectLegendary;

	UPROPERTY(EditAnywhere, BlueprintReadWrite)
	UAkAudioEvent* SoundEffectCharacter;

	UPROPERTY(EditAnywhere, BlueprintReadWrite)
	UAkAudioEvent* SoundEffectSpecialEvent;

	UPROPERTY(EditAnywhere, BlueprintReadWrite)
	UAkAudioEvent* SoundEffectProgression;

	UPROPERTY(EditAnywhere, BlueprintReadWrite)
	UAkAudioEvent* SoundEffectDisappear;

	UPROPERTY(EditAnywhere, BlueprintReadWrite)
	FString InputBlockerId;

public:
	UFUNCTION(BlueprintCallable)
	void StartAlertRewards();

	UFUNCTION(BlueprintCallable, BlueprintImplementableEvent)
	void SkipSequence();

private:
	UFUNCTION(BlueprintCallable)
	void ShowRewardTooltip(UCoreButtonWidget* rewardWidget);

	UFUNCTION(BlueprintCallable)
	void RewardAlertSequenceCompleted();

public:
	UFUNCTION(BlueprintCallable, BlueprintImplementableEvent)
	void PlaySoundEffect(UAkAudioEvent* soundFx);

	UFUNCTION(BlueprintCallable, BlueprintImplementableEvent)
	void PlayNextRewardsSequenceAnimation(const TArray<FRewardWrapperViewData>& AlertRewards);

	UFUNCTION(BlueprintCallable, BlueprintImplementableEvent)
	void PlayNextChallengesTrackersSequenceAnimation(const TArray<FChallengeTrackerViewData>& challengesTrackers);

	UFUNCTION(BlueprintCallable, BlueprintImplementableEvent)
	void PlayNextChallengesCompletedSequenceAnimation(const TArray<FChallengeViewData>& challengesCompleted);

	UFUNCTION(BlueprintCallable, BlueprintImplementableEvent)
	void PlayInterSequenceAnimation();

	UFUNCTION(BlueprintCallable, BlueprintImplementableEvent)
	void PlayEndSequenceAnimation();

	UFUNCTION(BlueprintCallable, BlueprintImplementableEvent)
	void PlayDisplayRewardSound(const FRewardWrapperViewData& rewardData);

	UFUNCTION(BlueprintCallable, BlueprintImplementableEvent)
	void PlayDisappearRewardSound();

	UFUNCTION(BlueprintCallable)
	void OnSkipTriggered();

	UFUNCTION(BlueprintPure)
	bool IsChallengeTrackerCompleted(FChallengeTrackerViewData challenge) const;

	UFUNCTION(BlueprintPure)
	bool IsChallengeCompleted(FChallengeViewData challenge) const;

private:
	UFUNCTION(BlueprintCallable)
	void HideRewardTooltip(UCoreButtonWidget* rewardWidget);

public:
	UFUNCTION(BlueprintPure)
	UAkAudioEvent* GetDisplayRewardSound(const FRewardWrapperViewData& rewardData) const;

	UFUNCTION(BlueprintCallable)
	void EndRewardDisplayRequested();

	UFUNCTION(BlueprintCallable)
	void EndInterSequenceAnimation();

	UFUNCTION(BlueprintCallable)
	void EndEndSequenceAnimation();

	UFUNCTION(BlueprintCallable)
	void EndChallengesTrackersSequenceAnimation();

	UFUNCTION(BlueprintCallable)
	void EndChallengesRewardsSequenceAnimation();

	UFUNCTION(BlueprintCallable)
	void EndChallengesCompletedSequenceAnimation();

private:
	UFUNCTION(BlueprintCallable)
	void DisplayNextRewardSequence();

	UFUNCTION(BlueprintCallable)
	void DisplayNextCompletedChallengesSequence();

	UFUNCTION(BlueprintCallable)
	void DisplayNextChallengesTrackersSequence();

	UFUNCTION(BlueprintCallable)
	void DisplayNextChallengesRewardsSequence();

	UFUNCTION(BlueprintCallable)
	void ChallengeTrackersSequenceCompleted();

	UFUNCTION(BlueprintCallable)
	void ChallengesRewardsSequenceCompleted();

	UFUNCTION(BlueprintCallable)
	void ChallengesCompletedSequenceCompleted();

public:
	UFUNCTION(BlueprintCallable)
	void AddElementsToSequence(const FAlertsViewData& alertsViewData);

public:
	UCoreAlertsWidget();
};

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