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


#include "WearOnlyUnderwearObjective.h"

#include "NakedDesire/Clothing/ClothingManager.h"
#include "NakedDesire/Player/NakedDesireCharacter.h"

#define LOCTEXT_NAMESPACE "Commissions.Objectives.WearOnlyUnderwear"

bool UWearOnlyUnderwearObjective::IsConditionMet() const
{
	if (!Player || !Player->ClothingManager)
		return false;

	UClothingManager* CM = Player->ClothingManager;

	const bool bUnderwearWorn =
		CM->IsClothingTypeOn(EClothingSlotType::UnderwearTop) ||
		CM->IsClothingTypeOn(EClothingSlotType::UnderwearBottom);

	const bool bOuterClear =
		!CM->IsClothingTypeOn(EClothingSlotType::Outerwear) &&
		!CM->IsClothingTypeOn(EClothingSlotType::Top) &&
		!CM->IsClothingTypeOn(EClothingSlotType::Bottom) &&
		!CM->IsClothingTypeOn(EClothingSlotType::Bodysuit);

	return bUnderwearWorn && bOuterClear;
}

FText UWearOnlyUnderwearObjective::GetDescription() const
{
	if (RequiredHoldSeconds > 0.0f)
	{
		return FText::Format(LOCTEXT("Timed", "Stay in just your underwear for {0} seconds"),
			FText::AsNumber(FMath::RoundToInt(RequiredHoldSeconds)));
	}

	return LOCTEXT("Instant", "Strip down to just your underwear");
}

#undef LOCTEXT_NAMESPACE