#pragma once

#include "CoreMinimal.h"
#include "ChargeableProgressSource.h"
#include "Components/ActorComponent.h"
#include "Templates/SubclassOf.h"
#include "Engine/NetSerialization.h"
#include "K38SurvivorHeldByDogComponent.generated.h"

class UK38SurvivorHeldByDogRotationStrategy;
class UK38SurvivorHeldByDogVelocityCalculationStrategy;
class UStatusEffect;
class UGateBlockerEffect;
class AK38Dog;
class ASurvivor;

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

private:
	UPROPERTY(EditAnywhere, BlueprintReadWrite, ReplicatedUsing=OnRep_AudioIsFightingBack, meta=(AllowPrivateAccess=true))
	bool _audioIsFightingBack;

	UPROPERTY(EditAnywhere, BlueprintReadWrite, ReplicatedUsing=OnRep_AudioIsPulling, meta=(AllowPrivateAccess=true))
	bool _audioIsPulling;

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

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

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

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

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

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

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

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

	UPROPERTY(EditAnywhere, BlueprintReadWrite, meta=(AllowPrivateAccess=true))
	TSubclassOf<UK38SurvivorHeldByDogRotationStrategy> _survivorRotationStrategyClass;

	UPROPERTY(EditAnywhere, BlueprintReadWrite, meta=(AllowPrivateAccess=true))
	TSubclassOf<UK38SurvivorHeldByDogVelocityCalculationStrategy> _survivorVelocityCalculationStrategyClass;

	UPROPERTY(EditAnywhere, BlueprintReadWrite, Transient, Export, meta=(AllowPrivateAccess=true))
	UK38SurvivorHeldByDogRotationStrategy* _rotationStrategy;

	UPROPERTY(EditAnywhere, BlueprintReadWrite, Transient, Export, meta=(AllowPrivateAccess=true))
	UK38SurvivorHeldByDogVelocityCalculationStrategy* _velocityCalculationStrategy;

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

	UPROPERTY(EditAnywhere, BlueprintReadWrite, meta=(AllowPrivateAccess=true))
	TSubclassOf<UGateBlockerEffect> _gateBlockingEffectClass;

	UPROPERTY(EditAnywhere, BlueprintReadWrite, Transient, Export, meta=(AllowPrivateAccess=true))
	UStatusEffect* _heldStatusEffectImposed;

	UPROPERTY(EditAnywhere, BlueprintReadWrite, ReplicatedUsing=OnRep_DogHoldingSurvivor, Transient, meta=(AllowPrivateAccess=true))
	AK38Dog* _dogHoldingSurvivor;

	UPROPERTY(EditAnywhere, BlueprintReadWrite, meta=(AllowPrivateAccess=true))
	FText _dogHoldingSurvivorChargeProgressDescriptionText;

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

	UPROPERTY(EditAnywhere, BlueprintReadWrite, Replicated, meta=(AllowPrivateAccess=true))
	FVector_NetQuantize _targetLocation;

private:
	UFUNCTION(BlueprintCallable, Server, Reliable)
	void Server_SetFightingBack(bool isFightingBack);

	UFUNCTION(BlueprintCallable)
	void OnRep_DogHoldingSurvivor(AK38Dog* oldValue);

	UFUNCTION(BlueprintCallable)
	void OnRep_AudioIsPulling(bool oldValue);

	UFUNCTION(BlueprintCallable)
	void OnRep_AudioIsFightingBack(bool oldValue);

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

public:
	UFUNCTION(BlueprintPure)
	AK38Dog* GetDogHoldingSurvivor() const;

protected:
	UFUNCTION(BlueprintCallable, BlueprintImplementableEvent, BlueprintCosmetic)
	void Cosmetic_OnSurvivorStopFightingBack();

	UFUNCTION(BlueprintCallable, BlueprintImplementableEvent, BlueprintCosmetic)
	void Cosmetic_OnSurvivorFightBack();

	UFUNCTION(BlueprintCallable, BlueprintImplementableEvent, BlueprintCosmetic)
	void Cosmetic_OnStruggleStarted();

	UFUNCTION(BlueprintCallable, BlueprintImplementableEvent, BlueprintCosmetic)
	void Cosmetic_OnStruggleEnded(AK38Dog* previouslyAttachedDog);

	UFUNCTION(BlueprintCallable, BlueprintImplementableEvent, BlueprintCosmetic)
	void Cosmetic_DogStopsPullingSurvivor();

	UFUNCTION(BlueprintCallable, BlueprintImplementableEvent, BlueprintCosmetic)
	void Cosmetic_DogStartsPullingSurvivor();

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

public:
	UK38SurvivorHeldByDogComponent();
};

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