#pragma once

// Clean-room implementation for HyperTwist algorithm-language subsystem
// Implemented from governance docs only (Phase 0R-D, Phase 1R, Phase 5R-A)
// Date: 2026-05-15
// Model: Claude (Model B, Bound 1 contribution)

#include "CoreMinimal.h"
#include "Kismet/BlueprintFunctionLibrary.h"
#include "HyperTwistAlgorithm/HyperTwistAlgorithmTypes.h"
#include "HyperTwistAlgorithmParser.generated.h"

UCLASS()
class UNREALHYPERTWIST_API UHyperTwistAlgorithmParser : public UBlueprintFunctionLibrary
{
	GENERATED_BODY()

public:
	// Parse algorithm text into AST
	UFUNCTION(BlueprintCallable, Category = "HyperTwist|Algorithm")
	static FHyperTwistAlgorithmParseResult ParseAlgorithm(const FString& AlgorithmText);

	// Parse algorithm text, returning empty sequence on error
	UFUNCTION(BlueprintCallable, Category = "HyperTwist|Algorithm")
	static FHyperTwistAlgorithmSequence ParseAlgorithmOrEmpty(const FString& AlgorithmText);

	// Parse from JSON representation
	UFUNCTION(BlueprintCallable, Category = "HyperTwist|Algorithm")
	static bool TryParseFromJson(
		const FString& JsonText,
		FHyperTwistAlgorithmSequence& OutSequence,
		FString& OutError
	);
};
