#include "HyperTwistTraining/HyperTwistTrainingRuntimeLibrary.h"

#include "Misc/AutomationTest.h"

IMPLEMENT_SIMPLE_AUTOMATION_TEST(
	FHyperTwistValidationPhaseJGWAntimensionStateLedgerContractTest,
	"HyperTwist.Validation.PhaseJGW.AntimensionStateLedgerContract",
	EAutomationTestFlags::EditorContext | EAutomationTestFlags::EngineFilter
)

bool FHyperTwistValidationPhaseJGWAntimensionStateLedgerContractTest::RunTest(const FString& Parameters)
{
	FHyperTwistTrainingValidationAntimensionStateLedgerContract Contract;
	const bool bResolved = UHyperTwistTrainingRuntimeLibrary::TryGetBundledValidationAntimensionStateLedgerContract(
		TEXT("validation-antimension-state-ledger-contract"),
		Contract);

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

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

	return true;
}

IMPLEMENT_SIMPLE_AUTOMATION_TEST(
	FHyperTwistValidationPhaseJGWOngoingStateEilitonBoundaryTest,
	"HyperTwist.Validation.PhaseJGW.OngoingStateEilitonBoundary",
	EAutomationTestFlags::EditorContext | EAutomationTestFlags::EngineFilter
)

bool FHyperTwistValidationPhaseJGWOngoingStateEilitonBoundaryTest::RunTest(const FString& Parameters)
{
	FHyperTwistTrainingValidationOngoingStateEilitonBoundary Boundary;
	const bool bResolved = UHyperTwistTrainingRuntimeLibrary::TryGetBundledValidationOngoingStateEilitonBoundary(
		TEXT("validation-ongoing-state-eiliton-boundary"),
		Boundary);

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

	TestEqual(
		TEXT("The validation ongoing-state eiliton boundary id must stay stable."),
		Boundary.BoundaryId,
		FString(TEXT("validation-ongoing-state-eiliton-boundary")));
	TestTrue(
		TEXT("The validation ongoing-state eiliton boundary must preserve reviewer-waiver eiliton anchors."),
		Boundary.EilitonIds.Contains(TEXT("ongoing-eiliton/reviewer-waiver-eiliton")));
	TestTrue(
		TEXT("The validation ongoing-state eiliton boundary must preserve the bounded ongoing-state eiliton surface."),
		Boundary.EilitonSurfaceTags.Contains(TEXT("bounded ongoing-state eiliton")));
	TestTrue(
		TEXT("The validation ongoing-state eiliton boundary must preserve the no-generic-ongoing-eiliton-platform guard."),
		Boundary.EilitonGuardTags.Contains(TEXT("no-generic-ongoing-eiliton-platform guard")));
	TestTrue(
		TEXT("The validation ongoing-state eiliton boundary must keep generic ongoing eiliton platform ownership excluded."),
		Boundary.ExplicitExclusions.Contains(TEXT("generic ongoing eiliton platform ownership")));

	return true;
}
