// Oleg Petruny proprietary.

#pragma once

#include "Engine/GameInstance.h"

#include "CustomGameInstanceBase.generated.h"

DECLARE_DYNAMIC_MULTICAST_DELEGATE_OneParam(FLevelBeginnedDelegate, FName, levelName);

UCLASS()
class UCustomGameInstanceBase : public UGameInstance
{
    GENERATED_BODY()

public:
    virtual void Init() override;

    UFUNCTION(BlueprintPure)
    static UCustomGameInstanceBase* GetGameInstance();

    UFUNCTION(BlueprintPure)
    static class UContentLoader* GetContentLoader();

    UFUNCTION(BlueprintCallable, Category = Settings)
    void ApplyMouseSettings();

    void AppendInteractableModificatorClass(TSubclassOf<class UInteractableModificator> modificator);

    UFUNCTION(BlueprintCallable, Category = Save)
    void SaveGame(FName checkpointName);
    UFUNCTION(BlueprintCallable, Category = Save)
    void LoadGame();
    UFUNCTION(BlueprintCallable)
    void ExitGame();

    static UCustomGameInstanceBase* instance;

    FLevelBeginnedDelegate OnLevelBeginned;

    UPROPERTY(EditDefaultsOnly)
    TSet<TSubclassOf<class UInteractableActivator>> interactionsActivators;
    TSet<TSubclassOf<class UInteractableModificator>> interactionsModificators;

    UPROPERTY(EditDefaultsOnly)
    TSet<TSoftObjectPtr<class UInputMappingContext>> inputContexts;

    UPROPERTY(VisibleAnywhere)
    class USaveData* saveData = nullptr;

protected:
    UPROPERTY()
    class UContentLoader* contentLoader;

};
