#pragma once

#include "CoreMinimal.h"
#include "GameFramework/Info.h"
#include "CoreMemoryChallengePlayerSpecificController.generated.h"

class ADBDPlayer;
class UCoreMemoryController;
class UCoreMemoryFragmentComponent;
class ACoreMemoryFragment;

UCLASS(Blueprintable)
class ACoreMemoryChallengePlayerSpecificController : public AInfo
{
	GENERATED_BODY()

private:
	UPROPERTY(EditInstanceOnly, BlueprintReadWrite, Replicated, Transient, meta=(AllowPrivateAccess=true))
	ADBDPlayer* _owningPlayer;

	UPROPERTY(EditInstanceOnly, BlueprintReadWrite, ReplicatedUsing=OnRep_Controller, Transient, Instanced, meta=(AllowPrivateAccess=true))
	UCoreMemoryController* _controller;

	UPROPERTY(EditInstanceOnly, BlueprintReadWrite, Replicated, Transient, Instanced, meta=(AllowPrivateAccess=true))
	TArray<UCoreMemoryFragmentComponent*> _fragments;

	UPROPERTY(EditAnywhere, BlueprintReadWrite, Replicated, meta=(AllowPrivateAccess=true))
	int32 _numFragmentsToCollect;

	UPROPERTY(EditInstanceOnly, Transient)
	TArray<TWeakObjectPtr<ACoreMemoryFragment>> _fragmentsSpawnedBeforeBehavioursWereSetup;

private:
	UFUNCTION(BlueprintCallable)
	void OnRep_Controller();

	UFUNCTION(BlueprintCallable)
	void OnPortalReplicated();

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

public:
	ACoreMemoryChallengePlayerSpecificController();
};

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