#pragma once

#include "CoreMinimal.h"
#include "CommonButtonBase.h"
#include "UIButton_Base.generated.h"

class USizeBox;
class UImage;
class UCanvasPanel;
class UCommonTextBlock;
class UTextBlock;

struct FUIStyle;
struct FUIStyleButton;

/**
 * Botão base do ZMMO (CommonUI). Hoje expõe BindWidgetOptional dos widgets
 * que o WBP UI_Button_Master_New consome, e helpers pra ler o estilo ativo
 * de DT_UI_Styles. A aplicação visual (pintar brushes/cores/fonte) entra
 * depois — esta camada só prepara o acesso.
 */
UCLASS(Abstract, Blueprintable)
class ZMMO_API UUIButton_Base : public UCommonButtonBase
{
	GENERATED_BODY()

protected:
	// ---- Widgets BindWidgetOptional (espelham a árvore do UI_Button_Master_New) ----
	UPROPERTY(BlueprintReadOnly, Category = "UI Button", meta = (BindWidgetOptional))
	TObjectPtr<USizeBox> SizeBox;

	UPROPERTY(BlueprintReadOnly, Category = "UI Button", meta = (BindWidgetOptional))
	TObjectPtr<UImage> ImgStoke;

	UPROPERTY(BlueprintReadOnly, Category = "UI Button", meta = (BindWidgetOptional))
	TObjectPtr<UCanvasPanel> CanvasPanel_Text;

	UPROPERTY(BlueprintReadOnly, Category = "UI Button", meta = (BindWidgetOptional))
	TObjectPtr<UCommonTextBlock> ButtonText;

	UPROPERTY(BlueprintReadOnly, Category = "UI Button", meta = (BindWidgetOptional))
	TObjectPtr<UTextBlock> Number_Text;

	UPROPERTY(BlueprintReadOnly, Category = "UI Button", meta = (BindWidgetOptional))
	TObjectPtr<UImage> ImgIcon;

	// ---- Acesso ao estilo ativo (DT_UI_Styles) — C++ only ----

	/** Carrega DT_UI_Styles e devolve o FUIStyle da row pedida (default "Default").
	 *  Retorna nullptr se a DT ou a row não existirem. Ponteiro válido enquanto
	 *  a DT estiver carregada — uso típico é leitura imediata, sem armazenar. */
	const FUIStyle* GetActiveUIStyle(FName ThemeId = TEXT("Default")) const;

	/** Atalho: devolve só o bloco Button do FUIStyle ativo. */
	const FUIStyleButton* GetActiveButtonStyle(FName ThemeId = TEXT("Default")) const;
};
