// Oleg Petruny proprietary.

#pragma once

#include "GameFramework/GameModeBase.h"

#include "MainGameModeBase.generated.h"

DECLARE_DYNAMIC_MULTICAST_DELEGATE_OneParam(FQuestsUpdateDelegate, TArray<FText>, quests);

/*
 * Manager of most gameplay systems.
 * Widgets, custcenes, QTE, dialogues, quests, camera mode, level.
 * Please, use MainGameMode SetPause to pause the game.
 */
UCLASS()
class AMainGameModeBase : public AGameModeBase
{
    GENERATED_BODY()

public:
    virtual void StartPlay() override;
    virtual void EndPlay(const EEndPlayReason::Type EndPlayReason) override;
    virtual bool SetPause(APlayerController* PC, FCanUnpause CanUnpauseDelegate = FCanUnpause()) override;

    UFUNCTION(BlueprintPure, meta = (DisplayName = "Get Main Game Mode"))
    static AMainGameModeBase* Get();
    UFUNCTION(BlueprintPure)
    static class UWidgetsManager* GetWidgetsManager();
    UFUNCTION(BlueprintPure)
    static class UCutsceneManager* GetCutsceneManager();
    UFUNCTION(BlueprintPure)
    static class UQuickTimeEventManager* GetQuickTimeEventManager();
    UFUNCTION(BlueprintPure)
    static class UDialogueManager* GetDialogueManager();

    UFUNCTION(BlueprintCallable)
    static void CallNextLevelState();
    UFUNCTION(BlueprintCallable)
    static void CallLevelEvent(int32 id);

    UFUNCTION(BlueprintCallable)
    static void UpdateQuests(TArray<FText> items);

    void SwitchCameraMode();

    static TStrongObjectPtr<class ALevelBase> leadLevel;

    FQuestsUpdateDelegate questsUpdateDelegate;

protected:
    UPROPERTY(EditDefaultsOnly)
    TSubclassOf<class UWidgetsManager> widgetManagerClass;

private:
    static AMainGameModeBase* instance;
    static TStrongObjectPtr<class UWidgetsManager> widgetsManager;
    static TStrongObjectPtr<class UCutsceneManager> cutsceneManager;
    static TStrongObjectPtr<class UQuickTimeEventManager> quickTimeEventManager;
    static TStrongObjectPtr<class UDialogueManager> dialogueManager;
};
