// Oleg Petruny proprietary.

#pragma once

#include "Components/ActorComponent.h"

#include "InteractableModificator.generated.h"

enum class EActivatorType : uint8;

/**
 * Do something on activation by specified activator types
 */
UCLASS(Abstract, Blueprintable, BlueprintType, ClassGroup = InteractableModificator, meta = (BlueprintSpawnableComponent, ShortTooltip = "Do something on activation by specified activator types"), MinimalAPI)
class UInteractableModificator : public UActorComponent
{
    GENERATED_BODY()

public:
    /** Append itself to CustomGameInstance modificators registry */
    virtual void OnRegister() override;

    /** Returns input mappings assigned in constructor */
    UFUNCTION(BlueprintCallable)
    const TSoftObjectPtr<class UInputMappingContext> GetMappingContext() const;

    /** Filters activation type in interractable */
    UFUNCTION(BlueprintCallable)
    EActivatorType GetActivatorTypes() const;

    /** Called from interactable on activation (mostly used to bind input context to internal modificator functions) */
    UFUNCTION(BlueprintNativeEvent, BlueprintCallable)
    void Bind(class UEnhancedInputComponent* input);
    virtual void Bind_Implementation(class UEnhancedInputComponent* input) {}

    /** Called from interactable on deactivation (mostly used to unbind input context from internal functions) */
    UFUNCTION(BlueprintNativeEvent, BlueprintCallable)
    void Unbind();
    virtual void Unbind_Implementation() {}

protected:
    UPROPERTY(EditDefaultsOnly, NoClear)
    TSoftObjectPtr<class UInputMappingContext> inputMapping;

    UPROPERTY(EditDefaultsOnly, NoClear, meta = (Bitmask, BitmaskEnum = "EActivatorType"))
    int32 activatorTypes = 0;

};
