#pragma once

#include "CoreMinimal.h"
#include "Components/ActorComponent.h"
#include "DBDTunableRowHandle.h"
#include "Templates/SubclassOf.h"
#include "UObject/NoExportTypes.h"
#include "ECamperDamageState.h"
#include "EPlayerTeam.h"
#include "K36ArtifactPowerComponent.generated.h"

class ALocker;
class UStatusEffect;
class AK36MagicItemArtifact;
class ASurvivor;

UCLASS(Blueprintable, Abstract, meta=(BlueprintSpawnableComponent))
class UK36ArtifactPowerComponent : public UActorComponent
{
	GENERATED_BODY()

protected:
	UPROPERTY(EditAnywhere, BlueprintReadWrite)
	FDBDTunableRowHandle _onLockerOpenedSmokeEffectTimeWindow;

	UPROPERTY(EditAnywhere, Replicated)
	TArray<TWeakObjectPtr<ALocker>> _cachedInGameLockers;

	UPROPERTY(EditAnywhere, Replicated)
	TArray<TWeakObjectPtr<ALocker>> _basementLockers;

private:
	UPROPERTY(EditAnywhere, BlueprintReadWrite, meta=(AllowPrivateAccess=true))
	float _basementBoxShrinkSize;

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

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

	UPROPERTY(EditAnywhere, BlueprintReadWrite, meta=(AllowPrivateAccess=true))
	TSubclassOf<UStatusEffect> _killerInstinctStatusEffectClass;

	UPROPERTY(EditAnywhere, BlueprintReadWrite, meta=(AllowPrivateAccess=true))
	TSubclassOf<UStatusEffect> _brokenStatusEffectClass;

	UPROPERTY(EditAnywhere, ReplicatedUsing=OnRep_Artifact)
	TWeakObjectPtr<AK36MagicItemArtifact> _artifact;

	UPROPERTY(EditAnywhere, BlueprintReadWrite, meta=(AllowPrivateAccess=true))
	FLinearColor _lockerShimmerOutlineColorForSurvivor;

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

private:
	UFUNCTION(BlueprintCallable)
	void OnSurvivorDamageStateChanged(ECamperDamageState oldDamageState, ECamperDamageState newDamageState);

	UFUNCTION(BlueprintCallable)
	void OnRep_Artifact();

protected:
	UFUNCTION(BlueprintPure)
	ASurvivor* GetOwningSurvivor() const;

	UFUNCTION(BlueprintCallable, BlueprintImplementableEvent, BlueprintCosmetic)
	void Cosmetic_ApplySmokeVfxOnOpenedLocker(ALocker* locker, EPlayerTeam playerTeam);

	UFUNCTION(BlueprintCallable, BlueprintImplementableEvent, BlueprintCosmetic)
	void Cosmetic_ApplySmokeEffectOnLocker(ALocker* locker);

private:
	UFUNCTION(BlueprintCallable)
	void Authority_OnLevelReadyToPlay();

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

public:
	UK36ArtifactPowerComponent();
};

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