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

#pragma once

#include "CoreMinimal.h"
#include "CommonButtonBase.h"
#include "Components/Image.h"
#include "NakedDesire/Clothing/ClothingSlotType.h"
#include "EquipmentSlotWidget.generated.h"

class UEquipmentSlotMenuWidget;
class ANakedDesireCharacter;
class UClothingSlotsData;
class UClothingItemInstance;

UCLASS(Abstract)
class NAKEDDESIRE_API UEquipmentSlotWidget : public UCommonButtonBase
{
	GENERATED_BODY()
	
public:
	void SetItem(UClothingItemInstance* InItem);
	void ClearItem();

	EClothingSlotType GetSlotType() const { return SlotType; }
	void SetSlotType(EClothingSlotType InSlotType);

	virtual void NativeConstruct() override;

	DECLARE_DELEGATE_OneParam(FOnEquipmentSlotClicked, UEquipmentSlotWidget* EquipmentSLotWidget)
	FOnEquipmentSlotClicked OnEquipmentSlotClicked;
	
protected:
	virtual void NativeOnClicked() override;
	virtual void NativePreConstruct() override;
	
	UPROPERTY(EditDefaultsOnly)
	TObjectPtr<UClothingSlotsData> ClothingSlotsData;
	
private:
	UPROPERTY(meta = (BindWIdget))
	TObjectPtr<UImage> PlaceholderImage;
	
	UPROPERTY(meta = (BindWIdget))
	TObjectPtr<UImage> IconImage;
	
	UPROPERTY()
	TObjectPtr<UClothingItemInstance> ClothingItemInstance = nullptr;
	
	UPROPERTY()
	EClothingSlotType SlotType = EClothingSlotType::Anal;
	
	UFUNCTION()
	void OnClothingEquip(UClothingItemInstance* InClothingItemInstance);
	
	UFUNCTION()
	void OnClothingUnequip(UClothingItemInstance* InClothingItemInstance);
	
	void InitSlotVisuals();
};
