// Fill out your copyright notice in the Description page of Project Settings.

#pragma once

#include "CoreMinimal.h"
#include "CommonActivatableWidget.h"
#include "StructUtils/InstancedStruct.h"
#include "FayeBaseWidget.generated.h"

class UWidgetControllerBase;

/**
 * 
 */
UCLASS()
class FAYE_API UFayeBaseWidget : public UCommonActivatableWidget
{
	GENERATED_BODY()
public:
	UFayeBaseWidget();
	virtual bool Initialize() override;
	
	UFUNCTION(BlueprintNativeEvent, BlueprintCallable, Category = "Faye Base Widget")
	void ToggleWidget(bool bActive);
	virtual void ToggleWidget_Implementation(bool bActive);
	
	UFUNCTION(Category = "Faye Base Widget")
	virtual void SetupWidget(const FInstancedStruct& DataPayload);
	UFUNCTION(BlueprintImplementableEvent, Category = "Faye Base Widget")
	void K2_SetupWidget(const FInstancedStruct& DataPayload);
	
	UFUNCTION(BlueprintPure, Category = "Faye Base Widget")
	UWidgetControllerBase* GetWidgetController() const { return WidgetController; }
	
	UPROPERTY(EditDefaultsOnly, BlueprintReadOnly)
	TSubclassOf<UWidgetControllerBase> ControllerClass;
	
protected:
	virtual void NativeOnActivated() override;
	virtual void NativeOnDeactivated() override;
	virtual bool NativeOnHandleBackAction() override;
	
	UPROPERTY()
	UWidgetControllerBase* WidgetController = nullptr;
};
