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

#pragma once

#include "CoreMinimal.h"
#include "GameFramework/Actor.h"
#include "LocationTrigger.generated.h"

class ULocationData;
class UBoxComponent;

// A tagged volume. On player overlap it reports enter / leave to ULocationSubsystem, which is the
// single authority on where the player is. Everything (session boundary, commission location
// constraints, etc.) consumes the subsystem — the trigger itself has no consumer-specific logic.
UCLASS()
class NAKEDDESIRE_API ALocationTrigger : public AActor
{
	GENERATED_BODY()

	UPROPERTY(BlueprintReadOnly, meta = (AllowPrivateAccess))
	UBoxComponent* BoxTrigger;

	UPROPERTY(EditAnywhere)
	ULocationData* LocationData;

public:
	ALocationTrigger();

	ULocationData* GetLocationData() const;

protected:
	virtual void BeginPlay() override;

private:
	UFUNCTION()
	void OnTriggerBeginOverlap(UPrimitiveComponent* OverlappedComponent, AActor* OtherActor,
		UPrimitiveComponent* OtherComp, int32 OtherBodyIndex, bool bFromSweep, const FHitResult& SweepResult);

	UFUNCTION()
	void OnTriggerEndOverlap(UPrimitiveComponent* OverlappedComponent, AActor* OtherActor,
		UPrimitiveComponent* OtherComp, int32 OtherBodyIndex);
};