// Oleg Petruny proprietary.

#pragma once

#include "CoreMinimal.h"
#include "GameFramework/Actor.h"

#include "Interactable.generated.h"

#define INTERACTABLE_DEBUG
//#define INTERACTABLE_ACTIVATOR_DEBUG

UENUM(BlueprintType, meta = (Bitflags))
enum class EActivatorType : uint8
{
    None = 0,
    Use = 1 << 0,
    Saw = 1 << 1,
    Custom1 = 1 << 2 UMETA(DisplayName = "Custom 1"),
    Custom2 = 1 << 3 UMETA(DisplayName = "Custom 2"),
    Custom3 = 1 << 4 UMETA(DisplayName = "Custom 3"),
    Custom4 = 1 << 5 UMETA(DisplayName = "Custom 4"),
    Custom5 = 1 << 6 UMETA(DisplayName = "Custom 5"),
    Custom6 = 1 << 7 UMETA(DisplayName = "Custom 6")
};
ENUM_CLASS_FLAGS(EActivatorType)

UCLASS(Abstract, MinimalAPI, Blueprintable, BlueprintType)
class AInteractable : public AActor
{
    GENERATED_BODY()

public:
    void _Activate(EActivatorType type);
    UFUNCTION(BlueprintNativeEvent, BlueprintCallable)
    void Activate(EActivatorType type);
    virtual void Activate_Implementation(EActivatorType type) {}

    void _Deactivate(EActivatorType type);
    UFUNCTION(BlueprintNativeEvent, BlueprintCallable)
    void Deactivate(EActivatorType type);
    virtual void Deactivate_Implementation(EActivatorType type) {}

protected:
    virtual void BeginPlay() override;

    UPROPERTY(BlueprintReadWrite, meta = (Bitmask, BitmaskEnum = "EActivatorType"))
    uint8 activated = 0;

    UPROPERTY(EditDefaultsOnly)
    TArray<TSubclassOf<class UInteractableModificator>> modificatorsClasses;

private:
    //UPROPERTY(EditDefaultsOnly)
    //TSoftObjectPtr<UMaterialInstance> material;
    TArray<class UInteractableModificator*> _modificators;
};

