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

#pragma once

#include "Commandlets/Commandlet.h"
#include "CoreMinimal.h"
#include "UObject/ObjectMacros.h"
#include "LODRecipeCommandlet.generated.h"

/**
* LOD recipe commandlet switches to be used as arguments to modify the output of the commandlet.
* Example: UE4Editor-Cmd.exe <ProjectName> -run=LODRecipeCommandlet -save -onlystaticmeshes
*/
UENUM()
enum class ELODRecipeCommandletSwitches
{
	/** Print commandlet help text.  */
	Help = 0,
	/** Save generated LODs and assets */
	Save,
	/** Enables source control. Checking out, adding and submitting files. */
	SourceControl,
	/** Specify one or more LOD recipes to build (separated with comma).*/
	LODRecipes,
	/** Generate LODs for static meshes only. */
	OnlyStaticMeshes,
	/** Generate LODs for skeletal meshes only. */
	OnlySkeletalMeshes,
	/** Number of enum values. */
	NUM,
};

/** 
* The following commandlet use the asset registry to look for LOD recipes and build them.
* Example: UE4Editor-Cmd.exe <ProjectName> -run=LODRecipeCommandlet -rebuild -nosourcecontrol
*/
UCLASS()
class ULODRecipeCommandlet : public UCommandlet
{
    GENERATED_BODY()

public:
	ULODRecipeCommandlet();

	//~ Begin UCommandlet Interface
	/** Commandlet entry point overriden from UCommandlet 
	* @param Params String containing the arguements for the commandlet
	*/
	virtual int32 Main(const FString& Params) override;
	//~ End UCommandlet Interface

private:
	/**
	* Parses the command line parameters
	* @param InParams - The parameters to parse
	*/
	bool ParseParams(const FString& InParams);

	/** Prints command line arguments */
	void PrintUsage();

private:
	TArray<FString> SelectedLODRecipes;
	bool bRunOnlyStaticMeshes;
	bool bRunOnlySkeletalMeshes;
	bool bShowHelp;
	bool bAllowSourceControl;
	bool bHasSourceControl;
	bool bSaveAssets;
	bool bBuildSelectedRecipes;
};
