#pragma once

#include "CoreMinimal.h"
#include "Components/ActorComponent.h"
#include "TrailData.h"
#include "TrailSettings.h"
#include "TunableStat.h"
#include "DBDTunableRowHandle.h"
#include "PatrolTrailComponent.generated.h"

class ATrailNode;

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

private:
	UPROPERTY(EditAnywhere, BlueprintReadWrite, Replicated, meta=(AllowPrivateAccess=true))
	FTrailData _trail;

	UPROPERTY(EditAnywhere, BlueprintReadWrite, ReplicatedUsing=OnRep_RemainingPathLengthPercent, meta=(AllowPrivateAccess=true))
	float _remainingPathLengthPercent;

	UPROPERTY(EditAnywhere, BlueprintReadWrite, meta=(AllowPrivateAccess=true))
	FTrailSettings _trailSettings;

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

	UPROPERTY(EditAnywhere, BlueprintReadWrite, meta=(AllowPrivateAccess=true))
	FTunableStat _maxPathLength;

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

private:
	UFUNCTION(BlueprintCallable)
	void OnRep_RemainingPathLengthPercent();

public:
	UFUNCTION(BlueprintPure)
	ATrailNode* GetLastNode() const;

	UFUNCTION(BlueprintPure)
	ATrailNode* GetFirstNode() const;

	UFUNCTION(BlueprintPure)
	float GetCurrentTrailLength() const;

	UFUNCTION(BlueprintPure)
	bool DoesTrailExist() const;

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

public:
	UPatrolTrailComponent();
};

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