// Oleg Petruny proprietary.

#pragma once

#include "Components/SceneComponent.h"
#include "CoreMinimal.h"

#include "Interactable/Interactable.h"

#include "InteractableActivator.generated.h"

DECLARE_DELEGATE_TwoParams(FInteractableActivated, AInteractable*, EActivatorType);
DECLARE_DELEGATE_TwoParams(FInteractableDeactivated, AInteractable*, EActivatorType);

UCLASS(Abstract, Blueprintable, BlueprintType)
class UInteractableActivator : public USceneComponent
{
    GENERATED_BODY()

public:
    UInteractableActivator(const FObjectInitializer& ObjectInitializer);
    virtual void TickComponent(float DeltaTime, enum ELevelTick TickType, FActorComponentTickFunction* ThisTickFunction) override;

    UFUNCTION(BlueprintNativeEvent, BlueprintCallable)
    LOST_EDGE_API void Rescan();
    virtual void Rescan_Implementation() {}

    FInteractableActivated interactableActivatedDelegate;
    FInteractableActivated interactableDeactivatedDelegate;

protected:
    UFUNCTION(BlueprintNativeEvent, BlueprintCallable)
    LOST_EDGE_API void Scan();
    virtual void Scan_Implementation() PURE_VIRTUAL(UInteractableActivator::Scan_Implementation, );

    UPROPERTY(EditDefaultsOnly)
    EActivatorType activatorType;

    UPROPERTY(EditDefaultsOnly)
    float scanDistance = 250;

    class UWorld* world;
    class APlayerBase* player;
    ECollisionChannel collisionChannel;
};
