#pragma once

#include "CoreMinimal.h"
#include "AnimTagProvider.h"
#include "GameFramework/Actor.h"
#include "AnimationMontageDescriptor.h"
#include "AnimationFollowerActor.generated.h"

class UDBDSkeletalMeshComponentBudgeted;
class UAnimationMontageSlave;
class UMontagePlayer;

UCLASS(Blueprintable)
class DEADBYDAYLIGHT_API AAnimationFollowerActor : public AActor, public IAnimTagProvider
{
	GENERATED_BODY()

protected:
	UPROPERTY(EditAnywhere, BlueprintReadWrite, Instanced)
	UDBDSkeletalMeshComponentBudgeted* _skeletalMeshComponent;

	UPROPERTY(EditAnywhere, BlueprintReadWrite, Instanced)
	UAnimationMontageSlave* _montageFollower;

	UPROPERTY(EditAnywhere, BlueprintReadWrite, Instanced)
	UMontagePlayer* _montagePlayer;

private:
	UPROPERTY(EditAnywhere, BlueprintReadWrite, meta=(AllowPrivateAccess=true))
	TArray<FName> _montageIDsLeavingActorVisible;

	UPROPERTY(EditAnywhere, BlueprintReadWrite, meta=(AllowPrivateAccess=true))
	bool _attachToMontageLeaderOnAnimationStart;

private:
	UFUNCTION(BlueprintCallable)
	void OnMontageStopped(const FAnimationMontageDescriptor montageID);

	UFUNCTION(BlueprintCallable)
	void OnMontageStarted(const FAnimationMontageDescriptor montageID, const float rate);

	UFUNCTION(BlueprintCallable)
	void OnMontageEnd(const FAnimationMontageDescriptor montageID, bool interrupted);

protected:
	UFUNCTION(BlueprintCallable)
	void NativeOnMontageStopped(const FAnimationMontageDescriptor id);

	UFUNCTION(BlueprintCallable)
	void NativeOnMontageStarted(const FAnimationMontageDescriptor id, const float rate);

	UFUNCTION(BlueprintCallable)
	void NativeOnMontageEnded(const FAnimationMontageDescriptor montage, bool interrupted);

	UFUNCTION(BlueprintCallable, BlueprintImplementableEvent, BlueprintCosmetic)
	void Cosmetic_OnVisibilityChanged(bool isVisible);

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

	UFUNCTION(BlueprintCallable, BlueprintImplementableEvent, BlueprintCosmetic)
	void Cosmetic_OnMontageStarted(const FAnimationMontageDescriptor& montagePlayed);

public:
	AAnimationFollowerActor();
};

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