#pragma once

#include "CoreMinimal.h"
#include "CoreBaseUserWidget.h"
#include "Templates/SubclassOf.h"
#include "Layout/Margin.h"
#include "CoreInboxListWidget.generated.h"

class UCoreInboxItemWidget;
class UDBDScrollBox;
class UVerticalBox;
class UCorePreConstructableList;
class UInboxItemViewData;

UCLASS(Blueprintable, EditInlineNew)
class DBDUIVIEWSCORE_API UCoreInboxListWidget : public UCoreBaseUserWidget
{
	GENERATED_BODY()

protected:
	UPROPERTY(EditAnywhere, BlueprintReadWrite)
	int32 _preConstructedItemsCount;

	UPROPERTY(EditAnywhere, BlueprintReadWrite, NoClear)
	TSubclassOf<UCoreInboxItemWidget> _itemWidgetClass;

	UPROPERTY(EditAnywhere, BlueprintReadWrite)
	FMargin _itemMargin;

	UPROPERTY(BlueprintReadWrite, meta=(BindWidgetOptional))
	UDBDScrollBox* ItemsScrollBox;

	UPROPERTY(BlueprintReadWrite, meta=(BindWidgetOptional))
	UVerticalBox* ItemsContainer;

private:
	UPROPERTY(BlueprintReadWrite, Transient, meta=(AllowPrivateAccess=true))
	UCorePreConstructableList* _itemList;

	UPROPERTY(BlueprintReadWrite, Transient, Instanced, meta=(AllowPrivateAccess=true))
	UCoreInboxItemWidget* _selectedItemWidget;

public:
	UFUNCTION(BlueprintCallable, BlueprintNativeEvent)
	void SetSelectedItem(const UInboxItemViewData* selectedItem);

	UFUNCTION(BlueprintCallable, BlueprintNativeEvent)
	void SetData(const TArray<UInboxItemViewData*>& data);

private:
	UFUNCTION(BlueprintCallable)
	void OnItemClicked(const FName& itemId);

public:
	UCoreInboxListWidget();
};

FORCEINLINE uint32 GetTypeHash(const UCoreInboxListWidget) { return 0; }
