#pragma once

#include "CoreMinimal.h"
#include "Components/ActorComponent.h"
#include "DreamStateChangedDelegate.h"
#include "Templates/SubclassOf.h"
#include "TagStateBool.h"
#include "CharacterDreamworldComponent.generated.h"

class AActor;
class UAmbianceManagerDataAsset;
class APostProcessUpdate;
class UObject;
class ADBDPlayer;

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

public:
	UPROPERTY(EditAnywhere, BlueprintReadWrite, BlueprintAssignable)
	FDreamStateChangedDelegate DreamStateChanged;

	UPROPERTY(EditAnywhere, BlueprintReadWrite)
	TSubclassOf<AActor> _mobileDreamworldPostProcessClass;

	UPROPERTY(EditAnywhere, BlueprintReadWrite)
	UAmbianceManagerDataAsset* _dreamWorldAmbiance;

private:
	UPROPERTY(EditAnywhere, BlueprintReadWrite, ReplicatedUsing=OnRep_IsInDreamworld, Transient, meta=(AllowPrivateAccess=true))
	FTagStateBool _isInDreamworld;

	UPROPERTY(EditAnywhere, BlueprintReadWrite, Transient, meta=(AllowPrivateAccess=true))
	APostProcessUpdate* _mobileDreamworldPostProcess;

public:
	UFUNCTION(BlueprintPure)
	bool ShouldShowVignette() const;

private:
	UFUNCTION(BlueprintCallable)
	void OnRep_IsInDreamworld();

public:
	UFUNCTION(BlueprintPure)
	bool IsInDreamworld() const;

	UFUNCTION(BlueprintPure)
	static ADBDPlayer* GetLocallyObservedOrLocalCharacter(UObject* worldContextObject);

	UFUNCTION(BlueprintCallable)
	void FireWakeUpScoreEvent(ADBDPlayer* instigator);

	UFUNCTION(BlueprintCallable, BlueprintAuthorityOnly)
	void Authority_SetIsInDreamworld(bool newValue, bool isScripted);

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

public:
	UCharacterDreamworldComponent();
};

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