#pragma once

#include "CoreMinimal.h"
#include "Components/ActorComponent.h"
#include "Templates/SubclassOf.h"
#include "DBDTunableRowHandle.h"
#include "GameplayTagContainer.h"
#include "TryksEffectCardsControllerComponent.generated.h"

class UTryksCard;

UCLASS(Blueprintable, Abstract, meta=(BlueprintSpawnableComponent))
class ANNIVERSARY2024_API UTryksEffectCardsControllerComponent : public UActorComponent
{
	GENERATED_BODY()

private:
	UPROPERTY(EditAnywhere, BlueprintReadWrite, meta=(AllowPrivateAccess=true))
	TArray<TSubclassOf<UTryksCard>> _cardsTemplates;

	UPROPERTY(EditAnywhere, BlueprintReadWrite, meta=(AllowPrivateAccess=true))
	FDBDTunableRowHandle _numberOfPossibleCards;

	UPROPERTY(EditAnywhere, BlueprintReadWrite, meta=(AllowPrivateAccess=true))
	FDBDTunableRowHandle _probabilityToPollSameCard;

	UPROPERTY(EditAnywhere, BlueprintReadWrite, meta=(AllowPrivateAccess=true))
	FDBDTunableRowHandle _probabilityToIncreaseForPrioritizedCards;

	UPROPERTY(EditAnywhere, BlueprintReadWrite, meta=(AllowPrivateAccess=true))
	FGameplayTagContainer _incrementPointsEvents;

	UPROPERTY(EditAnywhere, BlueprintReadWrite, meta=(AllowPrivateAccess=true))
	int32 _pointsNecessaryToActivateNextCard;

	UPROPERTY(EditInstanceOnly, BlueprintReadWrite, Transient, meta=(AllowPrivateAccess=true))
	TArray<UTryksCard*> _drawnCards;

private:
	UFUNCTION(BlueprintCallable, NetMulticast, Reliable)
	void Multicast_RedrawCards(const TArray<FString>& drawnCardsNames);

	UFUNCTION(BlueprintCallable, NetMulticast, Reliable)
	void Multicast_CreateCards(const TArray<FString>& drawnCardsNames);

protected:
	UFUNCTION(BlueprintCallable, BlueprintImplementableEvent, BlueprintCosmetic)
	void Cosmetic_OnPointGained(const int32 currentPoints);

	UFUNCTION(BlueprintCallable, BlueprintImplementableEvent, BlueprintCosmetic)
	void Cosmetic_OnCardEffectCompleted(UTryksCard* card);

	UFUNCTION(BlueprintCallable, BlueprintImplementableEvent, BlueprintCosmetic)
	void Cosmetic_OnCardDeactivatedDueToNothingHappened(UTryksCard* card);

	UFUNCTION(BlueprintCallable, BlueprintImplementableEvent, BlueprintCosmetic)
	void Cosmetic_OnCardDeactivated(UTryksCard* card);

	UFUNCTION(BlueprintCallable, BlueprintImplementableEvent, BlueprintCosmetic)
	void Cosmetic_OnCardActivated(UTryksCard* card);

public:
	UTryksEffectCardsControllerComponent();
};

FORCEINLINE uint32 GetTypeHash(const UTryksEffectCardsControllerComponent) { return 0; }
