#pragma once

#include "CoreMinimal.h"
#include "StatusEffect.h"
#include "DBDTunableRowHandle.h"
#include "FastTimer.h"
#include "DiminishingReturnBaseEffect.generated.h"

class ADBDPlayer;
class UGameplayModifierContainer;

UCLASS(Blueprintable, Abstract, EditInlineNew, meta=(BlueprintSpawnableComponent))
class DBDCOMPETENCE_API UDiminishingReturnBaseEffect : public UStatusEffect
{
	GENERATED_BODY()

public:
	UPROPERTY(EditAnywhere, BlueprintReadWrite)
	bool CheckOriginatingEffectsApplicable;

private:
	UPROPERTY(EditAnywhere, BlueprintReadWrite, meta=(AllowPrivateAccess=true))
	FDBDTunableRowHandle _effectRange;

	UPROPERTY(EditAnywhere, BlueprintReadWrite, meta=(AllowPrivateAccess=true))
	TArray<float> _capRatioPerStack;

	UPROPERTY(EditAnywhere, BlueprintReadWrite, Transient, meta=(AllowPrivateAccess=true))
	TArray<ADBDPlayer*> _originatingPlayersInRange;

	UPROPERTY(EditAnywhere, BlueprintReadWrite, Transient, meta=(AllowPrivateAccess=true))
	TMap<ADBDPlayer*, FFastTimer> _originatingPlayersActivatedLifetimeInRange;

	UPROPERTY(EditAnywhere, BlueprintReadWrite, Transient, Export, meta=(AllowPrivateAccess=true))
	TArray<UGameplayModifierContainer*> _originatingEffectsApplicable;

	UPROPERTY(EditAnywhere, BlueprintReadWrite, ReplicatedUsing=OnRep_OriginatingPlayersApplyingEffect, meta=(AllowPrivateAccess=true))
	TArray<ADBDPlayer*> _originatingPlayersApplyingEffect;

private:
	UFUNCTION(BlueprintCallable)
	void OnRep_OriginatingPlayersApplyingEffect(TArray<ADBDPlayer*> previousOriginatingPlayersApplyingEffect);

protected:
	UFUNCTION(BlueprintCallable, BlueprintImplementableEvent, BlueprintCosmetic)
	void Cosmetic_OnInRangeChanged(bool isInRange);

private:
	UFUNCTION(BlueprintCallable)
	void Authority_OnOriginatingEffectApplicableChanged(UGameplayModifierContainer* gameplayModifierContainer, bool isApplicable);

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

public:
	UDiminishingReturnBaseEffect();
};

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