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


#include "WardrobeItemWidget.h"
#include "CommonTextBlock.h"
#include "Components/Image.h"
#include "NakedDesire/Clothing/ClothingItemInstance.h"

void UWardrobeItemWidget::SetClothingItemInstance(UClothingItemInstance* InItemInstance)
{
	ClothingItemInstance = InItemInstance;
	
	UpdateVisuals();
}

void UWardrobeItemWidget::NativeOnClicked()
{
	Super::NativeOnClicked();
	
	OnItemClicked.ExecuteIfBound(this);
}

void UWardrobeItemWidget::UpdateVisuals()
{
	if (!ClothingItemInstance)
		return;
	
	IconImage->SetBrushFromTexture(ClothingItemInstance->GetClothingItemDefinition()->Icon);
	NameText->SetText(ClothingItemInstance->GetClothingItemDefinition()->Name);
}
