// Oleg Petruny proprietary.

#pragma once

#include "QuickTimeEvent.h" // forward declaration of EQuickTimeEventResult is somehow insufficient on some machines
#include "Widgets/ResolutionResponsiveUserWidget.h"

#include "QuickTimeEventWidget.generated.h"

enum class EQuickTimeEventResult : uint8;

UCLASS(Blueprintable, Abstract)
class UQuickTimeEventWidget : public UResolutionResponsiveUserWidget
{
    GENERATED_BODY()

public:
    void Show();

    UFUNCTION(BlueprintCallable)
    void RemoveEvent();

    UFUNCTION(BlueprintImplementableEvent, BlueprintCallable)
    void Process(const bool released);
    EQuickTimeEventResult _Process(const bool released);

    UFUNCTION(BlueprintImplementableEvent, BlueprintCallable)
    void ProcessBeforeRemoving();
    EQuickTimeEventResult _ProcessBeforeRemoving();

    UPROPERTY(meta = (BindWidget))
    class UTextBlock* keyText;

    int32 id;
    class UQuickTimeEventWidgetManager* manager;
    float duration;

protected:
    virtual void NativeConstruct() override;

    UFUNCTION()
    void RemoveFromManager();

    UPROPERTY(Transient, meta = (BindWidgetAnim))
    class UWidgetAnimation* eventAnimation;

    UPROPERTY(Transient, meta = (BindWidgetAnim))
    class UWidgetAnimation* removeAnimation;

    UPROPERTY(BlueprintReadWrite)
    EQuickTimeEventResult result = EQuickTimeEventResult::FailedKey; // special state to do nothing;

    bool removing = false;
};
