#pragma once

#include "CoreMinimal.h"
#include "BaseSurvivorCollectable.h"
#include "EK41MushroomState.h"
#include "UObject/NoExportTypes.h"
#include "K41Mushroom.generated.h"

class UStaticMeshComponent;
class UAkComponent;
class UTimerObject;
class UFloatValueStrategy;
class UAuthoritativePoolableActorComponent;
class UAkAudioEvent;
class ASurvivor;

UCLASS(Blueprintable)
class THEK41_API AK41Mushroom : public ABaseSurvivorCollectable
{
	GENERATED_BODY()

protected:
	UPROPERTY(EditAnywhere, BlueprintReadWrite, Instanced)
	UStaticMeshComponent* _mushroomMesh;

	UPROPERTY(EditAnywhere, BlueprintReadWrite, Instanced)
	UStaticMeshComponent* _mushroomBaseMesh;

	UPROPERTY(EditAnywhere, BlueprintReadWrite, Instanced)
	UAkComponent* _akComponent;

private:
	UPROPERTY(EditAnywhere, BlueprintReadWrite, ReplicatedUsing=OnRep_CurrentState, meta=(AllowPrivateAccess=true))
	EK41MushroomState _currentState;

	UPROPERTY(EditAnywhere, BlueprintReadWrite, Replicated, Instanced, meta=(AllowPrivateAccess=true))
	UTimerObject* _decayTimer;

	UPROPERTY(EditAnywhere, BlueprintReadWrite, Instanced, meta=(AllowPrivateAccess=true))
	UFloatValueStrategy* _spawnDuration;

	UPROPERTY(EditAnywhere, BlueprintReadWrite, Instanced, meta=(AllowPrivateAccess=true))
	UFloatValueStrategy* _decayDuration;

	UPROPERTY(EditAnywhere, BlueprintReadWrite, Instanced, meta=(AllowPrivateAccess=true))
	UFloatValueStrategy* _survivorRangeWhenDropped;

	UPROPERTY(EditAnywhere, BlueprintReadWrite, Instanced, meta=(AllowPrivateAccess=true))
	UAuthoritativePoolableActorComponent* _poolableActorComponent;

	UPROPERTY(EditAnywhere, BlueprintReadWrite, meta=(AllowPrivateAccess=true))
	FVector _crushPalletExtentAddedRange;

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

	UPROPERTY(EditAnywhere, BlueprintReadWrite, meta=(AllowPrivateAccess=true))
	UAkAudioEvent* _decayEndAudioEvent;

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

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

private:
	UFUNCTION(BlueprintCallable)
	void OnRep_CurrentState(EK41MushroomState previousState);

public:
	UFUNCTION(BlueprintPure)
	bool IsInAnyState(TArray<EK41MushroomState> mushroomStates) const;

protected:
	UFUNCTION(BlueprintPure)
	bool IsDecayTimerActive() const;

	UFUNCTION(BlueprintPure)
	float GetSpawnDuration() const;

public:
	UFUNCTION(BlueprintPure)
	EK41MushroomState GetMushroomState() const;

	UFUNCTION(BlueprintPure)
	bool GetHasBeenPickedUp() const;

	UFUNCTION(BlueprintCallable, BlueprintImplementableEvent, BlueprintCosmetic)
	void Cosmetic_OnSurvivorConsumedMushroom(ASurvivor* survivor);

protected:
	UFUNCTION(BlueprintCallable, BlueprintImplementableEvent, BlueprintCosmetic)
	void Cosmetic_OnStateChanged(EK41MushroomState currentState, EK41MushroomState previousState);

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

public:
	AK41Mushroom();
};

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