#pragma once

#include "CoreMinimal.h"
#include "WingServer.h"
#include "WingHandler.h"
#include "WingTokenizer.h"
#include "Test_Unsanitize.generated.h"


// ---------------------------------------------------------------------------
// ---------------------------------------------------------------------------
// ---------------------------------------------------------------------------

UCLASS()
class UWing_Test_Unsanitize : public UWingHandler
{
	GENERATED_BODY()

public:
	UPROPERTY(EditAnywhere, meta=(Description="The sanitized identifier to unsanitize"))
	FString Input;

	virtual void Register() override
	{
		UWingServer::AddHandler(this,
			TEXT("Test the unsanitizer by unsanitizing a string and printing the result."));
	}
	virtual void Handle() override
	{
		FString Error;
		FName Result = WingTokenizer::TryInternalizeID(Input, Error);
		if (!Error.IsEmpty())
		{
			UWingServer::Printf(TEXT("Error: %s\n"), *Error);
		}
		if (!Result.IsNone())
		{
			UWingServer::Printf(TEXT("Result: %s\n"), *Result.ToString());
		}
	}
};
