// Copyright ExByte Studios. Item Interaction Ecosystem.

#pragma once

#include "CoreMinimal.h"
#include "Components/ActorComponent.h"
#include "GameplayTagContainer.h"
#include "InteractableComponent.generated.h"

class UInteractionAction;

/**
 * Marks an actor as interactable and lists the actions it offers (section 8.1).
 * Attach to pickups, chests, vehicles, generators, doors, workbenches, corpses,
 * placed items, quest objects, etc.
 */
UCLASS(ClassGroup = (Interaction), meta = (BlueprintSpawnableComponent))
class ITEMINTERACTION_API UInteractableComponent : public UActorComponent
{
	GENERATED_BODY()

public:
	UInteractableComponent();

	UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = "Interaction")
	FGameplayTag InteractableType;

	UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = "Interaction")
	FText DisplayName;

	UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = "Interaction")
	float InteractionDistance = 250.f;

	UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = "Interaction")
	bool bRequiresLineOfSight = true;

	/** Free-form world tags exposed to the interaction context (e.g. Vehicle, Generator). */
	UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = "Interaction")
	FGameplayTagContainer InteractionTags;

	/** Explicit action classes this object offers (in addition to data-driven item rows). */
	UPROPERTY(EditAnywhere, BlueprintReadOnly, Instanced, Category = "Interaction")
	TArray<TObjectPtr<UInteractionAction>> AvailableActions;

	/** Server-side soft claim so two players don't interact with the same object at once. */
	UPROPERTY(BlueprintReadOnly, Category = "Interaction")
	bool bIsBusy = false;
};
