// © 2025 Naked People Team. All Rights Reserved.

#pragma once

#include "CoreMinimal.h"
#include "GameFramework/Character.h"
#include "NPCType.h"
#include "NPC.generated.h"

class UNPCVisualsConfig;
class ANPCTargetLocation;
class UNPCTypeDefinition;

UCLASS()
class NAKEDDESIRE_API ANPC : public ACharacter
{
	GENERATED_BODY()

public:
	ANPC();

	// Behavioral template for this NPC (Walker / Stalker / …). Author one DA_* per type and assign
	// here (or on the NPC blueprint). Null falls back to Walker-ish defaults (GDD §10.2, §17.4).
	UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = "NPC")
	TMap<ENPCType, TObjectPtr<UNPCTypeDefinition>> NPCTypeDefinitions;

	UFUNCTION(BlueprintPure, Category = "NPC")
	ENPCType GetNPCType() const;

	// Multiplier on this NPC's embarrassment contribution; read by StatsManager via the AI controller.
	UFUNCTION(BlueprintPure, Category = "NPC")
	float GetObservationWeight() const;

	// True for Stalker-like types; the behavior tree branches on this to stop and stare vs. walk past.
	UFUNCTION(BlueprintPure, Category = "NPC")
	bool ShouldStopToObserve() const;

	// Seconds a stopping NPC lingers staring before resuming its path.
	UFUNCTION(BlueprintPure, Category = "NPC")
	float GetObserveDuration() const;

	// Pooling lifecycle driven by UNPCDirectorSubsystem. The native side handles transform /
	// visibility / collision / movement; the BlueprintImplementableEvents let the behavior-tree
	// layer restart and pick a fresh destination (BT startup lives in BP, §17.5).
	void ActivateFromPool(const FVector& Location, const FRotator& Rotation);
	void DeactivateToPool();
	void Init(ENPCType InType);

protected:
	UPROPERTY(BlueprintReadWrite, Category = "NPC")
	TObjectPtr<ANPCTargetLocation> TargetLocationActor;
	
private:
	UPROPERTY()
	ENPCType Type = ENPCType::None;
	
	UPROPERTY()
	TObjectPtr<UNPCTypeDefinition> TypeDefinition;
};