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

#pragma once

#include "CoreMinimal.h"
#include "NakedDesire/Commissions/CommissionObjective.h"
#include "MoveDistanceFromClothingObjective.generated.h"

class UDroppedClothingSubsystem;

// §13.4 MoveDistanceFromClothing(meters): reach RequiredMeters of separation from the nearest clothing
// you left on the ground (UDroppedClothingSubsystem). Distance has no event, so the objective polls.
// Never auto-satisfies when nothing has been dropped — there is nothing to move away from.
//
// ReachLocationAwayFromClothing(tag, meters) needs no new class: author this objective with a
// ULocationConstraint, and the base ANDs the location gate into the satisfaction check.
UCLASS(EditInlineNew, DisplayName = "Move Distance From Clothing")
class NAKEDDESIRE_API UMoveDistanceFromClothingObjective : public UCommissionObjective
{
	GENERATED_BODY()

public:
	virtual FText GetDescription() const override;
	virtual float GetProgress() const override;

protected:
	virtual void OnActivate() override;
	virtual void OnDeactivate() override;
	virtual bool IsConditionMet() const override;

private:
	void Poll();
	UDroppedClothingSubsystem* GetDroppedClothing() const;

	UPROPERTY(EditDefaultsOnly, meta = (ClampMin = 1))
	float RequiredMeters = 50.0f;

	FTimerHandle PollTimer;
};