
#pragma once

#include "CoreMinimal.h"
#include "GameplayTagContainer.h"
#include "Helpers/StatEffectModCalculation.h"
#include "StatForgeDefs.generated.h"


UENUM(BlueprintType)
enum class EStatDefClampMode : uint8
{
	None,
	FlatValue,
	Stat
};

USTRUCT(BlueprintType)
struct STATFORGE_API FStatDefClampMode
{
	GENERATED_BODY()
	
	UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Stat Forge|Stats")
	EStatDefClampMode ClampMode = EStatDefClampMode::None;
	
	UPROPERTY(EditAnywhere, BlueprintReadWrite, DisplayName = "Value", Category = "Stat Forge|Stats", meta = (EditCondition = "ClampMode==EStatDefClampMode::FlatValue", EditConditionHides))
	float ClampModeFlatValue = 0.f;
	
	UPROPERTY(EditAnywhere, BlueprintReadWrite, DisplayName = "Stat Reference", Category = "Stat Forge|Stats", meta = (EditCondition = "ClampMode==EStatDefClampMode::Stat", EditConditionHides, GetOptions = "StatForgeDeveloperSettings.GetStatNames"))
	FName ClampModeStatValue;
};

USTRUCT(BlueprintType)
struct STATFORGE_API FStatDef
{
	GENERATED_BODY()
	
	UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Stat Forge|Stats")
	FName StatName;
	
	UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Stat Forge|Stats")
	FText StatDescriptiveName;
	
	UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Stat Forge|Stats")
	FStatDefClampMode ClampMode;
	
	bool IsValid() const { return !StatName.IsNone(); }
};

USTRUCT(BlueprintType)
struct STATFORGE_API FStatRuntimeDef
{
	GENERATED_BODY()
	
	FStatRuntimeDef() { StatDef = FStatDef(); }
	explicit FStatRuntimeDef(const FStatDef& Def)
	{
		StatDef = Def;
	}
	
	UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category = "Stat Forge|Stats")
	FStatDef StatDef;
	
	UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category = "Stat Forge|Stats")
	float BaseValue = 0.f;
	
	UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category = "Stat Forge|Stats")
	float CurrentValue = 0.f;
	
	float GetBaseValue() const { return BaseValue; }
	float GetCurrentValue() const { return CurrentValue; }
};
