#pragma once

#include "CoreMinimal.h"
#include "ArchiveJournalViewInterface.h"
#include "CoreTabContentWidget.h"
#include "UObject/SoftObjectPtr.h"
#include "VignetteSelected.h"
#include "VignetteEntrySelected.h"
#include "VignetteCinematicPlayed.h"
#include "VignetteVoiceOverPlayed.h"
#include "VignetteVoiceOverAutoplay.h"
#include "VignetteShowImageViewer.h"
#include "ReadAllJournalEntries.h"
#include "CoreArchiveJournalWidget.generated.h"

class UCoreArchiveVignetteButtonContainerWidget;
class UCoreArchiveVignetteEntryContainerWidget;
class UCoreArchiveVignetteCinematicContainerWidget;
class UCoreInputSwitcherWidget;
class UTexture2D;
class UCoreSelectableButtonWidget;

UCLASS(Blueprintable, EditInlineNew)
class DBDUIVIEWSCORE_API UCoreArchiveJournalWidget : public UCoreTabContentWidget, public IArchiveJournalViewInterface
{
	GENERATED_BODY()

protected:
	UPROPERTY(BlueprintReadWrite, meta=(BindWidgetOptional))
	UCoreArchiveVignetteButtonContainerWidget* VignetteButtonContainer;

	UPROPERTY(BlueprintReadWrite, meta=(BindWidgetOptional))
	UCoreArchiveVignetteEntryContainerWidget* VignetteEntryContainer;

	UPROPERTY(BlueprintReadWrite, meta=(BindWidgetOptional))
	UCoreArchiveVignetteCinematicContainerWidget* VignetteCinematicsContainer;

	UPROPERTY(BlueprintReadWrite, meta=(BindWidgetOptional))
	UCoreInputSwitcherWidget* LeftArrowInputSwitcher;

	UPROPERTY(BlueprintReadWrite, meta=(BindWidgetOptional))
	UCoreInputSwitcherWidget* RightArrowInputSwitcher;

	UPROPERTY(EditAnywhere, BlueprintReadWrite)
	bool AreInputsEnabled;

	UPROPERTY(EditInstanceOnly, BlueprintReadWrite, Transient)
	TSoftObjectPtr<UTexture2D> DebugRewardImage;

	UPROPERTY(EditAnywhere, BlueprintReadWrite)
	uint8 RewardImageMaxDescriptionLength;

private:
	UPROPERTY(BlueprintReadWrite, meta=(AllowPrivateAccess=true, BindWidgetOptional))
	UCoreInputSwitcherWidget* _readAllInputSwitcher;

	UPROPERTY(EditAnywhere, BlueprintReadWrite, BlueprintCallable, meta=(AllowPrivateAccess=true))
	FVignetteSelected _vignetteSelectedDelegate;

	UPROPERTY(EditAnywhere, BlueprintReadWrite, BlueprintCallable, meta=(AllowPrivateAccess=true))
	FVignetteEntrySelected _vignetteEntrySelectedDelegate;

	UPROPERTY(EditAnywhere, BlueprintReadWrite, BlueprintCallable, meta=(AllowPrivateAccess=true))
	FVignetteCinematicPlayed _vignetteCinematicPlayedDelegate;

	UPROPERTY(EditAnywhere, BlueprintReadWrite, BlueprintCallable, meta=(AllowPrivateAccess=true))
	FVignetteVoiceOverPlayed _vignetteVoiceOverPlayedDelegate;

	UPROPERTY(EditAnywhere, BlueprintReadWrite, BlueprintCallable, meta=(AllowPrivateAccess=true))
	FVignetteVoiceOverAutoplay _vignetteVoiceOverAutoplayDelegate;

	UPROPERTY(EditAnywhere, BlueprintReadWrite, BlueprintCallable, meta=(AllowPrivateAccess=true))
	FVignetteShowImageViewer _vignetteShowImageViewerDelegate;

	UPROPERTY(EditAnywhere, BlueprintReadWrite, BlueprintCallable, meta=(AllowPrivateAccess=true))
	FReadAllJournalEntries _readAllJournalEntriesDelegate;

public:
	UFUNCTION(BlueprintCallable)
	void ShowImageViewer();

	UFUNCTION(BlueprintCallable, BlueprintImplementableEvent)
	void SetVoiceOverText(const FText& playVoiceOverText, const FText& stopVoiceOverText, const FText& autoplayVoiceOverText);

	UFUNCTION(BlueprintCallable, BlueprintImplementableEvent)
	void SetVoiceOverButtonsVisibility(const bool isVisible);

	UFUNCTION(BlueprintCallable, BlueprintImplementableEvent)
	void SetTopFogOffset(bool hasTitle, bool hasDescription);

	UFUNCTION(BlueprintCallable)
	void SetReadAllButton(UCoreInputSwitcherWidget* readAllInputSwitcher);

	UFUNCTION(BlueprintCallable, BlueprintImplementableEvent)
	void SetEntryText(const FText& titleText, const FText& descriptionText);

	UFUNCTION(BlueprintCallable, BlueprintImplementableEvent)
	void SetEntryImage(const FText& titleText, const FText& descriptionText, const TSoftObjectPtr<UTexture2D>& rewardImage, float textureOffset);

	UFUNCTION(BlueprintCallable, BlueprintImplementableEvent)
	void SetBottomFogOffset(bool hasAudio);

private:
	UFUNCTION(BlueprintCallable)
	void SetArrowButtons();

public:
	UFUNCTION(BlueprintCallable)
	void OnVoiceOverPlay();

	UFUNCTION(BlueprintCallable)
	void OnVoiceOverAutoPlay(bool autoplay);

	UFUNCTION(BlueprintCallable)
	void OnVignetteEntrySelected(UCoreSelectableButtonWidget* selectedButton);

	UFUNCTION(BlueprintCallable)
	void OnVignetteCinematicSelected(UCoreSelectableButtonWidget* selectedButton);

	UFUNCTION(BlueprintCallable)
	void OnVignetteButtonSelected(UCoreSelectableButtonWidget* selectedButton);

private:
	UFUNCTION(BlueprintCallable)
	void OnRightArrowTriggered();

	UFUNCTION(BlueprintCallable)
	void OnRewardImageLoaded(TSoftObjectPtr<UTexture2D> loadedTexture, bool success, FText titleText, FText descriptionText, float textureOffset);

	UFUNCTION(BlueprintCallable)
	void OnReadAllButtonClicked();

	UFUNCTION(BlueprintCallable)
	void OnLeftArrowTriggered();

	UFUNCTION(BlueprintCallable)
	void InitializeArrow(UCoreInputSwitcherWidget* arrowWidget, bool active);

public:
	UCoreArchiveJournalWidget();
};

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