// Copyright (c) Microsoft Corporation. 
// Licensed under the MIT license.

#pragma once

#include "CoreMinimal.h"
#include "LODRecipe.h"

class LODRECIPE_API FLODRecipeRegistry
{
public:
	static FLODRecipeRegistry& Get();

	TSoftObjectPtr<ULODRecipe> FindLODRecipe(TSoftObjectPtr<UObject> Mesh);
	
protected:
	FLODRecipeRegistry();

	void Add(TSoftObjectPtr<UObject> Mesh, ULODRecipe* LODRecipe);
	void Remove(TSoftObjectPtr<UObject> Mesh);

private:
	void RefreshRegistry();
	void OnInitialAssetRegistrySearchComplete();

private:
	TMap<FSoftObjectPath, FSoftObjectPath> MeshToRecipeMap{};

	FDelegateHandle OnAssetRegFilesLoaded;

	friend ULODRecipe;
};
