// Fill out your copyright notice in the Description page of Project Settings.

#pragma once

#include "CoreMinimal.h"
#include "Data/StatForgeDefs.h"
#include "Engine/DeveloperSettings.h"
#include "StatForgeDeveloperSettings.generated.h"

/**
 * 
 */
UCLASS(Config = Game, defaultconfig, meta = (DisplayName = "Stat Forge Settings"))
class STATFORGE_API UStatForgeDeveloperSettings : public UDeveloperSettings
{
	GENERATED_BODY()
public:
	UPROPERTY(Config, EditAnywhere, BlueprintReadWrite, Category = "Setup")
	TArray<FStatDef> StatMap;
	
#if WITH_EDITOR
	virtual void PostEditChangeProperty(struct FPropertyChangedEvent& PropertyChangedEvent) override;
	virtual void PostReloadConfig(class FProperty* PropertyThatWasLoaded) override;
#endif
	
	FStatDef GetStatByName(FName StatName) const;
	
	UFUNCTION()
	static TArray<FName> GetStatNames();
	const FStatDef* FindStat(const FName& StatName) const;
	void EnsureRegistryMerged() { MergeRegistryIntoStatMap(); }
	
protected:
	
	virtual void PostInitProperties() override;
	
private:
	void MergeRegistryIntoStatMap();

};
