#include "HyperTwistTraining/HyperTwistTrainingRuntimeLibrary.h"

#include "Misc/AutomationTest.h"

IMPLEMENT_SIMPLE_AUTOMATION_TEST(
	FHyperTwistValidationPhaseJGLSticharionStateLedgerContractTest,
	"HyperTwist.Validation.PhaseJGL.SticharionStateLedgerContract",
	EAutomationTestFlags::EditorContext | EAutomationTestFlags::EngineFilter
)

bool FHyperTwistValidationPhaseJGLSticharionStateLedgerContractTest::RunTest(const FString& Parameters)
{
	FHyperTwistTrainingValidationSticharionStateLedgerContract Contract;
	const bool bResolved = UHyperTwistTrainingRuntimeLibrary::TryGetBundledValidationSticharionStateLedgerContract(
		TEXT("validation-sticharion-state-ledger-contract"),
		Contract);

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

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

	return true;
}

IMPLEMENT_SIMPLE_AUTOMATION_TEST(
	FHyperTwistValidationPhaseJGLOngoingStateZonarionBoundaryTest,
	"HyperTwist.Validation.PhaseJGL.OngoingStateZonarionBoundary",
	EAutomationTestFlags::EditorContext | EAutomationTestFlags::EngineFilter
)

bool FHyperTwistValidationPhaseJGLOngoingStateZonarionBoundaryTest::RunTest(const FString& Parameters)
{
	FHyperTwistTrainingValidationOngoingStateZonarionBoundary Boundary;
	const bool bResolved = UHyperTwistTrainingRuntimeLibrary::TryGetBundledValidationOngoingStateZonarionBoundary(
		TEXT("validation-ongoing-state-zonarion-boundary"),
		Boundary);

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

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

	return true;
}
