#pragma once

#include "CoreMinimal.h"
#include "Factories/Factory.h"
#include "Factories/EnumFactory.h"
#include "WingFactories.generated.h"



class WingFactories
{
public:
	// Create an asset on disk, using a factory instance.
	// Returns the main object. If there are problems,
	// prints error messages and returns nullptr.
	static UObject *CreateAsset(const FString &Path, UFactory *Factory);

	// Some factories are blacklisted, mainly because they
	// pop up dialog boxes. In those cases, we deal with it
	// primarily by adding those factories to the blacklist,
	// and then implementing replacement factories.
	static bool IsBlacklisted(UClass* FactoryClass);

	// This takes a factory name and turns it into a string
	// that we can present to the user.  Mainly, it removes
	// the word 'Factory', and anything that comes after.
	static FString DeriveFactoryName(UClass* FactoryClass);

	// Verifies that the asset path is a valid path, and also
	// that there's not something already there at that path.
	static bool CheckNewAssetPath(const FString &Path);
};

// The original UEnumFactory may pop a dialog.  We made a better one.
UCLASS()
class UEnumFactoryWing : public UEnumFactory
{
	GENERATED_BODY()
public:
	virtual UObject* FactoryCreateNew(UClass* Class, UObject* InParent, FName Name, EObjectFlags Flags, UObject* Context, FFeedbackContext* Warn) override;
};