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

#pragma once

#include "CoreMinimal.h"
#include "ClothingSlotData.h"
#include "Components/ActorComponent.h"
#include "NakedDesire/Player/PrivateBodyPartType.h"
#include "ClothingManager.generated.h"

// TODO: Check clothing colors

class UGlobalSaveGameData;
class AClothingPickup;
class UClothingItemInstance;

DECLARE_DYNAMIC_MULTICAST_DELEGATE_OneParam(FOnClothingChangeSignature, const UClothingItemInstance*, ClothingItemInstance);

UCLASS( ClassGroup=(Custom), meta=(BlueprintSpawnableComponent) )
class NAKEDDESIRE_API UClothingManager : public UActorComponent
{
	GENERATED_BODY()

public:
	UClothingManager();

	UPROPERTY(BlueprintReadWrite, Category = "Clothing Manager|Clothing")
	USkeletalMeshComponent* RootMesh = nullptr;

	UPROPERTY(BlueprintReadWrite, Category = "Clothing Manager|Clothing")
	TArray<FClothingSlotData> ClothingSlots;
	
	UPROPERTY(BlueprintAssignable)
	FOnClothingChangeSignature OnClothingEquip;
	
	UPROPERTY(BlueprintAssignable)
	FOnClothingChangeSignature OnClothingUnequip;

	UPROPERTY(BlueprintAssignable)
	FOnClothingChangeSignature OnClothingDropped;

	
	UFUNCTION(BlueprintCallable)
	void PutOnClothing(UClothingItemInstance* ClothingItemInstance);
	
	UFUNCTION(BlueprintCallable)
	void DropClothing(const EClothingSlotType ClothingType);
	
	UFUNCTION(BlueprintCallable)
	bool IsClothingTypeOn(const EClothingSlotType ClothingType);
	
	UFUNCTION(BlueprintCallable)
	bool IsPartiallyNaked();
	
	UFUNCTION(BlueprintCallable)
	bool IsBodyTypeExposed(EPrivateBodyPartType PrivateBodyPartType);
	
	UFUNCTION(BlueprintCallable)
	void TakeClothing(UClothingItemInstance* ClothingItemInstance);
	
	UFUNCTION(BlueprintCallable)
	UClothingItemInstance* RemoveClothing(EClothingSlotType ClothingSlotType);
	
	UFUNCTION(BlueprintCallable)
	bool GetClothingSlotData(EClothingSlotType ClothingSlotType, FClothingSlotData& OutClothingSlotData);
	
	UFUNCTION(BlueprintCallable)
	void SetClothingSlotItem(const EClothingSlotType ClothingSlotType, UClothingItemInstance* ClothingItemInstance);

	UFUNCTION(BlueprintCallable)
	TArray<UClothingItemInstance*> GetEquippedClothing();

	void HydrateClothing(UGlobalSaveGameData* SaveGameData);

	UFUNCTION(BlueprintPure)
	float GetHeelHeight();
};
