#pragma once

#include "CoreMinimal.h"
#include "Components/ActorComponent.h"
#include "ETrailDirection.h"
#include "EPatrolState.h"
#include "SpeedBasedNetSyncedValue.h"
#include "TunableStat.h"
#include "GuardPatrolComponent.generated.h"

class UGuardVisionUpdater;

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

private:
	UPROPERTY(EditAnywhere, BlueprintReadWrite, Replicated, meta=(AllowPrivateAccess=true))
	ETrailDirection _currentDirection;

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

	UPROPERTY(EditAnywhere, BlueprintReadWrite, ReplicatedUsing=OnRep_PatrolState, meta=(AllowPrivateAccess=true))
	EPatrolState _patrolState;

	UPROPERTY(EditAnywhere, BlueprintReadWrite, Replicated, meta=(AllowPrivateAccess=true))
	FSpeedBasedNetSyncedValue _patrolTimeLeft;

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

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

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

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

	UPROPERTY(EditAnywhere, BlueprintReadWrite, Instanced, meta=(AllowPrivateAccess=true))
	UGuardVisionUpdater* _visionUpdater;

private:
	UFUNCTION(BlueprintCallable)
	void OnRep_PatrolState();

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

public:
	UGuardPatrolComponent();
};

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