#include "HyperTwistTraining/HyperTwistTrainingRuntimeLibrary.h"

#include "Misc/AutomationTest.h"

IMPLEMENT_SIMPLE_AUTOMATION_TEST(
	FHyperTwistValidationPhaseJGGTabarroStateLedgerContractTest,
	"HyperTwist.Validation.PhaseJGG.TabarroStateLedgerContract",
	EAutomationTestFlags::EditorContext | EAutomationTestFlags::EngineFilter
)

bool FHyperTwistValidationPhaseJGGTabarroStateLedgerContractTest::RunTest(const FString& Parameters)
{
	FHyperTwistTrainingValidationTabarroStateLedgerContract Contract;
	const bool bResolved = UHyperTwistTrainingRuntimeLibrary::TryGetBundledValidationTabarroStateLedgerContract(
		TEXT("validation-tabarro-state-ledger-contract"),
		Contract);

	TestTrue(
		TEXT("The validation tabarro-state ledger contract must resolve from the runtime library."),
		bResolved);
	if (!bResolved)
	{
		return false;
	}

	TestEqual(
		TEXT("The validation tabarro-state ledger contract id must stay stable."),
		Contract.ContractId,
		FString(TEXT("validation-tabarro-state-ledger-contract")));
	TestTrue(
		TEXT("The validation tabarro-state ledger contract must preserve benchmark-drift tabarro ledger entries."),
		Contract.LedgerIds.Contains(TEXT("tabarro-state-ledger/benchmark-drift-tabarro")));
	TestTrue(
		TEXT("The validation tabarro-state ledger contract must preserve the bounded tabarro-state ledger surface."),
		Contract.LedgerSurfaceTags.Contains(TEXT("bounded tabarro-state ledger")));
	TestTrue(
		TEXT("The validation tabarro-state ledger contract must preserve the no-generic-tabarro-state-platform guard."),
		Contract.TabarroGuardTags.Contains(TEXT("no-generic-tabarro-state-platform guard")));
	TestTrue(
		TEXT("The validation tabarro-state ledger contract must keep generic tabarro-state platform ownership excluded."),
		Contract.ExplicitExclusions.Contains(TEXT("generic tabarro-state platform ownership")));

	return true;
}

IMPLEMENT_SIMPLE_AUTOMATION_TEST(
	FHyperTwistValidationPhaseJGGOngoingStateGremialeBoundaryTest,
	"HyperTwist.Validation.PhaseJGG.OngoingStateGremialeBoundary",
	EAutomationTestFlags::EditorContext | EAutomationTestFlags::EngineFilter
)

bool FHyperTwistValidationPhaseJGGOngoingStateGremialeBoundaryTest::RunTest(const FString& Parameters)
{
	FHyperTwistTrainingValidationOngoingStateGremialeBoundary Boundary;
	const bool bResolved = UHyperTwistTrainingRuntimeLibrary::TryGetBundledValidationOngoingStateGremialeBoundary(
		TEXT("validation-ongoing-state-gremiale-boundary"),
		Boundary);

	TestTrue(
		TEXT("The validation ongoing-state gremiale boundary must resolve from the runtime library."),
		bResolved);
	if (!bResolved)
	{
		return false;
	}

	TestEqual(
		TEXT("The validation ongoing-state gremiale boundary id must stay stable."),
		Boundary.BoundaryId,
		FString(TEXT("validation-ongoing-state-gremiale-boundary")));
	TestTrue(
		TEXT("The validation ongoing-state gremiale boundary must preserve manual-waiver gremiale anchors."),
		Boundary.GremialeIds.Contains(TEXT("ongoing-gremiale/manual-waiver-gremiale")));
	TestTrue(
		TEXT("The validation ongoing-state gremiale boundary must preserve the bounded ongoing-state gremiale surface."),
		Boundary.GremialeSurfaceTags.Contains(TEXT("bounded ongoing-state gremiale")));
	TestTrue(
		TEXT("The validation ongoing-state gremiale boundary must preserve the no-generic-ongoing-gremiale-platform guard."),
		Boundary.GremialeGuardTags.Contains(TEXT("no-generic-ongoing-gremiale-platform guard")));
	TestTrue(
		TEXT("The validation ongoing-state gremiale boundary must keep generic ongoing gremiale platform ownership excluded."),
		Boundary.ExplicitExclusions.Contains(TEXT("generic ongoing gremiale platform ownership")));

	return true;
}
