#pragma once

#include "CoreMinimal.h"
#include "CoreBaseUserWidget.h"
#include "AnalyticsComponent.h"
#include "Framework/Text/TextLayout.h"
#include "OnKeyListenerInputPromptTriggeredDelegate.h"
#include "OnKeyListenerInputPromptPressedDelegate.h"
#include "OnKeyListenerInputPromptReleasedDelegate.h"
#include "EUIActionType.h"
#include "InputCoreTypes.h"
#include "UObject/SoftObjectPtr.h"
#include "CoreKeyListenerInputPromptWidget.generated.h"

class UCoreInputPromptWidget;
class UDBDTextBlock;
class UDBDImage;
class UAkAudioEvent;
class UCurveFloat;
class UTexture2D;

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

public:
	UPROPERTY(EditAnywhere, BlueprintReadWrite)
	FAnalyticsComponent Analytics;

protected:
	UPROPERTY(BlueprintReadWrite, meta=(BindWidgetOptional))
	UCoreInputPromptWidget* InputPrompt;

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

	UPROPERTY(BlueprintReadWrite, meta=(BindWidgetOptional))
	UDBDImage* AdditionalIconIMG;

	UPROPERTY(EditAnywhere, BlueprintReadWrite)
	TEnumAsByte<ETextJustify::Type> _alignment;

	UPROPERTY(EditAnywhere, BlueprintReadWrite)
	FString ClickedSfxName;

	UPROPERTY(EditAnywhere, BlueprintReadWrite)
	UAkAudioEvent* ClickedSfx;

	UPROPERTY(EditAnywhere, BlueprintReadWrite)
	FString StartedChargingSfxName;

	UPROPERTY(EditAnywhere, BlueprintReadWrite)
	UAkAudioEvent* StartedChargingSfx;

	UPROPERTY(EditAnywhere, BlueprintReadWrite)
	FString CancelledChargingSfxName;

	UPROPERTY(EditAnywhere, BlueprintReadWrite)
	UAkAudioEvent* CancelledChargingSfx;

	UPROPERTY(EditAnywhere, BlueprintReadWrite)
	FString CompletedChargingSfxName;

	UPROPERTY(EditAnywhere, BlueprintReadWrite)
	UAkAudioEvent* CompletedChargingSfx;

private:
	UPROPERTY(BlueprintReadWrite, BlueprintAssignable, BlueprintCallable, meta=(AllowPrivateAccess=true))
	FOnKeyListenerInputPromptTriggeredDelegate _onKeyListenerInputPromptTriggeredDelegate;

	UPROPERTY(BlueprintReadWrite, BlueprintAssignable, BlueprintCallable, meta=(AllowPrivateAccess=true))
	FOnKeyListenerInputPromptPressedDelegate _onKeyListenerInputPromptPressedDelegate;

	UPROPERTY(BlueprintReadWrite, BlueprintAssignable, BlueprintCallable, meta=(AllowPrivateAccess=true))
	FOnKeyListenerInputPromptReleasedDelegate _onKeyListenerInputPromptReleasedDelegate;

	UPROPERTY(EditInstanceOnly, BlueprintReadWrite, Transient, SkipSerialization, meta=(AllowPrivateAccess=true))
	UCurveFloat* _repetitionDelayCurve;

	UPROPERTY(EditInstanceOnly, BlueprintReadWrite, Transient, SkipSerialization, meta=(AllowPrivateAccess=true))
	UCurveFloat* _chargingAnimCurve;

public:
	UFUNCTION(BlueprintCallable)
	void SetUIAction(const EUIActionType actionType);

	UFUNCTION(BlueprintCallable)
	void SetRepeatable(bool isRepeatable, UCurveFloat* repetitionDelayCurve);

	UFUNCTION(BlueprintCallable)
	void SetLabel(const FText& label);

	UFUNCTION(BlueprintCallable)
	void SetKeyOverride(const FKey keyOverride);

	UFUNCTION(BlueprintCallable)
	void SetEnabled(bool isEnabled);

	UFUNCTION(BlueprintCallable)
	void SetChargeable(bool isChargeable, UCurveFloat* holdingAnimCurve, float duration);

	UFUNCTION(BlueprintCallable)
	void SetBetaFeatureOverlayVisible(bool isVisible);

	UFUNCTION(BlueprintCallable)
	void SetAlignment(ETextJustify::Type newAlignment);

	UFUNCTION(BlueprintCallable)
	void SetAdditionalIcon(TSoftObjectPtr<UTexture2D> iconTexture);

private:
	UFUNCTION(BlueprintCallable)
	void SendAnalyticsData();

protected:
	UFUNCTION(BlueprintCallable, BlueprintImplementableEvent)
	void OnEnabledChanged(bool isEnabled);

	UFUNCTION(BlueprintCallable, BlueprintImplementableEvent)
	void OnChargingTick(float progress);

	UFUNCTION(BlueprintCallable, BlueprintImplementableEvent)
	void OnChargingComplete();

	UFUNCTION(BlueprintCallable, BlueprintImplementableEvent)
	void OnAlignmentChanged(ETextJustify::Type newAlignment);

public:
	UFUNCTION(BlueprintPure)
	bool IsEnabled() const;

	UFUNCTION(BlueprintPure)
	bool IsCharging() const;

public:
	UCoreKeyListenerInputPromptWidget();
};

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