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

#pragma once

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

class UButton;
class UImage;
class UCommonTextBlock;
class UPhoneAppWidget;
class UTexture2D;

// One launcher icon on the phone home screen. Built at runtime by UPhoneHomeScreenWidget from its
// AppEntries array; broadcasts the app class to launch when tapped.
UCLASS(Abstract)
class NAKEDDESIRE_API UPhoneAppIconWidget : public UCommonUserWidget
{
	GENERATED_BODY()

public:
	void Init(const FText& InName, UTexture2D* InIcon, UMaterialInterface* InBgMaterial, TSubclassOf<UPhoneAppWidget> InAppClass);

	DECLARE_DELEGATE_OneParam(FOnAppIconClicked, TSubclassOf<UPhoneAppWidget>);
	FOnAppIconClicked OnClicked;

private:
	UPROPERTY(meta = (BindWidget))
	TObjectPtr<UImage> BackgroundImage;
	
	UPROPERTY(meta = (BindWidget))
	TObjectPtr<UButton> IconButton;

	UPROPERTY(meta = (BindWidget))
	TObjectPtr<UImage> IconImage;

	UPROPERTY(meta = (BindWidget))
	TObjectPtr<UCommonTextBlock> NameText;

	UPROPERTY()
	TSubclassOf<UPhoneAppWidget> AppClass;

	UFUNCTION()
	void HandleClicked();
};