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

#pragma once

#include "CoreMinimal.h"
#include "CommonUserWidget.h"
#include "WardrobeInventoryWidget.generated.h"

class UVerticalBox;
class UWardrobeItemWidget;
class UInventorySubsystem;

UCLASS(Abstract)
class NAKEDDESIRE_API UWardrobeInventoryWidget : public UCommonUserWidget
{
	GENERATED_BODY()

	UPROPERTY(EditDefaultsOnly)
	TSubclassOf<UWardrobeItemWidget> WardrobeItemWidgetClass;

	UPROPERTY(meta = (BindWidget))
	TObjectPtr<UVerticalBox> ItemsList;

public:
	void Init();

protected:
	virtual void NativeDestruct() override;

private:
	UInventorySubsystem* GetInventory() const;

	UFUNCTION()
	void HandleWardrobeChanged();

	void HandleItemClicked(UWardrobeItemWidget* ItemWidget);
	void RenderItems();
};