#pragma once

#include "CoreMinimal.h"
#include "CoreButtonSelector.h"
#include "Templates/SubclassOf.h"
#include "Layout/Margin.h"
#include "CorePresetContainerWidget.generated.h"

class UHorizontalBox;
class UCorePresetWidget;
class UCorePreConstructableList;
class UCoreSelectableButtonWidget;

UCLASS(Blueprintable, EditInlineNew)
class DBDUIVIEWSCORE_API UCorePresetContainerWidget : public UCoreButtonSelector
{
	GENERATED_BODY()

public:
	DECLARE_DYNAMIC_MULTICAST_DELEGATE_OneParam(FOnSelectedPresetDelegate, int32, selectedPreset);

public:
	UPROPERTY(EditAnywhere, BlueprintReadWrite, BlueprintAssignable)
	FOnSelectedPresetDelegate OnSelectedPresetDelegate;

protected:
	UPROPERTY(EditAnywhere, BlueprintReadWrite, meta=(BindWidgetOptional))
	UHorizontalBox* PresetsContainer;

	UPROPERTY(EditAnywhere, BlueprintReadWrite, NoClear)
	TSubclassOf<UCorePresetWidget> _presetItemWidgetClass;

	UPROPERTY(EditAnywhere, BlueprintReadWrite, NoClear)
	int32 _preConstructedPresetsCount;

	UPROPERTY(EditAnywhere, BlueprintReadWrite, NoClear)
	FMargin _presetsPadding;

private:
	UPROPERTY(EditAnywhere, BlueprintReadWrite, Transient, Export, meta=(AllowPrivateAccess=true))
	TArray<UCorePresetWidget*> _presetWidgets;

	UPROPERTY(EditAnywhere, BlueprintReadWrite, Transient, meta=(AllowPrivateAccess=true))
	UCorePreConstructableList* _presetList;

public:
	UFUNCTION(BlueprintCallable)
	void SetPresetData(const TArray<int32>& presetData, const int32 selectedPreset);

	UFUNCTION(BlueprintPure)
	UCorePresetWidget* GetSelectedPreset() const;

private:
	UFUNCTION(BlueprintCallable)
	void BroadcastSelectedPreset(UCoreSelectableButtonWidget* selectedButton);

public:
	UCorePresetContainerWidget();
};

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