#pragma once

#include "CoreMinimal.h"
#include "ChargeableProgressSource.h"
#include "TimedEffectWidgetInterface.h"
#include "Components/ActorComponent.h"
#include "DBDTunableRowHandle.h"
#include "GameplayTagContainer.h"
#include "AnimationMontageDescriptor.h"
#include "EHealthState.h"
#include "RecoverComponent.generated.h"

UCLASS(Blueprintable, meta=(BlueprintSpawnableComponent))
class DEADBYDAYLIGHT_API URecoverComponent : public UActorComponent, public IChargeableProgressSource, public ITimedEffectWidgetInterface
{
	GENERATED_BODY()

protected:
	UPROPERTY(EditAnywhere, BlueprintReadWrite)
	FText _recoverChargeProgressDescriptionText;

	UPROPERTY(EditAnywhere, BlueprintReadWrite)
	FText _findHelpText;

private:
	UPROPERTY(EditAnywhere, BlueprintReadWrite, ReplicatedUsing=OnRep_HasReachedRecoverStopPercent, meta=(AllowPrivateAccess=true))
	bool _hasReachedRecoverStopPercent;

	UPROPERTY(EditAnywhere, BlueprintReadWrite, ReplicatedUsing=OnRep_IsRecoverOngoing, meta=(AllowPrivateAccess=true))
	bool _isRecoverOngoing;

	UPROPERTY(EditInstanceOnly, BlueprintReadWrite, Transient, meta=(AllowPrivateAccess=true))
	float _cumulativeRecoverProgress;

	UPROPERTY(EditAnywhere, BlueprintReadWrite, meta=(AllowPrivateAccess=true))
	FDBDTunableRowHandle _recoverStopPercent;

	UPROPERTY(EditAnywhere, BlueprintReadWrite, meta=(AllowPrivateAccess=true))
	FDBDTunableRowHandle _survivorRecoverHealSpeedMultiplier;

	UPROPERTY(EditAnywhere, BlueprintReadWrite, meta=(AllowPrivateAccess=true))
	FDBDTunableRowHandle _selfRecoveryUnlockThreshold;

	UPROPERTY(EditAnywhere, BlueprintReadWrite, meta=(AllowPrivateAccess=true))
	FDBDTunableRowHandle _selfRecoveryUnlockIncreaseRate;

	UPROPERTY(EditAnywhere, BlueprintReadWrite, meta=(AllowPrivateAccess=true))
	FDBDTunableRowHandle _selfRecoveryUnlockIncreaseRateMaxStacks;

	UPROPERTY(EditAnywhere)
	TArray<FGameplayTag> _stateTagsForCumulativeRecoverExemption;

private:
	UFUNCTION(BlueprintCallable)
	void OnRep_IsRecoverOngoing(bool oldValue);

	UFUNCTION(BlueprintCallable)
	void OnRep_HasReachedRecoverStopPercent();

	UFUNCTION(BlueprintCallable)
	void OnLevelReadyToPlay();

	UFUNCTION(BlueprintCallable)
	void OnKnockoutMontageStarted(const FAnimationMontageDescriptor montageDescriptor, const float rate);

	UFUNCTION(BlueprintCallable)
	void Authority_OnOwningSurvivorHealthStateChanged(EHealthState oldHealthState, EHealthState newHealthState);

public:
	virtual void GetLifetimeReplicatedProps(TArray<FLifetimeProperty>& OutLifetimeProps) const override;

public:
	URecoverComponent();
};

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