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

#pragma once

#include "CoreMinimal.h"
#include "NakedDesire/Clothing/BodyPart.h"
#include "ObserverObjectiveBase.h"
#include "CoverageObjectiveBase.generated.h"

class UClothingItemInstance;

// Shared base for objectives that read body coverage; re-evaluates on any equip / unequip. Inherits
// the observer subscription from UObserverObjectiveBase, so coverage objectives can also gate on the
// current observer count (e.g. "naked in front of N people") without extra wiring.
UCLASS(Abstract)
class NAKEDDESIRE_API UCoverageObjectiveBase : public UObserverObjectiveBase
{
	GENERATED_BODY()

protected:
	virtual void OnActivate() override;
	virtual void OnDeactivate() override;

	// Fully unclothed: no effective coverage on any of the three exposable regions.
	bool IsFullyNaked() const;

	// Part reads as "revealing" — below the player's observation reveal threshold.
	bool IsPartRevealing(EBodyPart Part) const;

	// Raw effective coverage [0,1] for a part — for objectives that name their own threshold.
	float GetEffectiveCoverage(EBodyPart Part) const;

	// Any of the three regions is revealing.
	bool IsAnyPartRevealing() const;

private:
	UFUNCTION()
	void HandleClothingChanged(UClothingItemInstance* ClothingItemInstance);
};