#pragma once

#include "CoreMinimal.h"
#include "TimedEffectWidgetInterface.h"
#include "Components/ActorComponent.h"
#include "ETimedEffectMeterState.h"
#include "DBDTunableRowHandle.h"
#include "AntiCampSelfUnhookComponent.generated.h"

class UCurveFloat;
class UChargeableComponent;
class ADBDPlayer;

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

private:
	UPROPERTY(BlueprintReadWrite, ReplicatedUsing=OnRep_State, Transient, meta=(AllowPrivateAccess=true))
	ETimedEffectMeterState _state;

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

	UPROPERTY(EditAnywhere, BlueprintReadWrite, meta=(AllowPrivateAccess=true))
	UCurveFloat* _antiCampUnhookXYDistanceToChargeCurve;

	UPROPERTY(EditAnywhere, BlueprintReadWrite, meta=(AllowPrivateAccess=true))
	UCurveFloat* _antiCampUnhookUpperZDistanceToChargeCurve;

	UPROPERTY(EditAnywhere, BlueprintReadWrite, meta=(AllowPrivateAccess=true))
	UCurveFloat* _antiCampUnhookLowerZDistanceToChargeCurve;

	UPROPERTY(EditAnywhere, BlueprintReadWrite, meta=(AllowPrivateAccess=true))
	UCurveFloat* _antiCampUnhookBasementZDistanceToChargeCurve;

	UPROPERTY(EditAnywhere, BlueprintReadWrite, meta=(AllowPrivateAccess=true))
	UCurveFloat* _antiCampUnhookBasementLowerZDistanceToChargeCurve;

	UPROPERTY(EditAnywhere, BlueprintReadWrite, meta=(AllowPrivateAccess=true))
	float _antiCampGracePeriod;

	UPROPERTY(BlueprintReadWrite, ReplicatedUsing=OnRep_Progress, Transient, meta=(AllowPrivateAccess=true))
	float _progress;

public:
	UFUNCTION(BlueprintCallable)
	void SetAntiCampUnhookChargeable(UChargeableComponent* component);

private:
	UFUNCTION(BlueprintCallable)
	void OnRep_State(ETimedEffectMeterState previousState);

	UFUNCTION(BlueprintCallable)
	void OnRep_Progress();

	UFUNCTION(BlueprintCallable)
	void OnHookedSurvivorDrainStageChanged(const int32 drainStage, ADBDPlayer* target);

	UFUNCTION(BlueprintCallable)
	void OnEscapeDoorActivated();

public:
	UFUNCTION(BlueprintPure)
	float GetProgress() const;

	UFUNCTION(BlueprintPure)
	float GetAntiCampMaxXYCurveDistanceTime() const;

	UFUNCTION(BlueprintPure)
	float GetAntiCampMaxUpperZCurveDistanceTime() const;

	UFUNCTION(BlueprintPure)
	float GetAntiCampMaxLowerZCurveDistanceTime() const;

	UFUNCTION(BlueprintPure)
	float GetAntiCampGracePeriod() const;

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

public:
	UAntiCampSelfUnhookComponent();
};

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