#include "HyperTwistTraining/HyperTwistTrainingRuntimeLibrary.h"

#include "Misc/AutomationTest.h"

IMPLEMENT_SIMPLE_AUTOMATION_TEST(
	FHyperTwistValidationPhaseJHBHexapterygonStateLedgerContractTest,
	"HyperTwist.Validation.PhaseJHB.HexapterygonStateLedgerContract",
	EAutomationTestFlags::EditorContext | EAutomationTestFlags::EngineFilter
)

bool FHyperTwistValidationPhaseJHBHexapterygonStateLedgerContractTest::RunTest(const FString& Parameters)
{
	FHyperTwistTrainingValidationHexapterygonStateLedgerContract Contract;
	const bool bResolved = UHyperTwistTrainingRuntimeLibrary::TryGetBundledValidationHexapterygonStateLedgerContract(
		TEXT("validation-hexapterygon-state-ledger-contract"),
		Contract);

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

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

	return true;
}

IMPLEMENT_SIMPLE_AUTOMATION_TEST(
	FHyperTwistValidationPhaseJHBOngoingStateCherubikonBoundaryTest,
	"HyperTwist.Validation.PhaseJHB.OngoingStateCherubikonBoundary",
	EAutomationTestFlags::EditorContext | EAutomationTestFlags::EngineFilter
)

bool FHyperTwistValidationPhaseJHBOngoingStateCherubikonBoundaryTest::RunTest(const FString& Parameters)
{
	FHyperTwistTrainingValidationOngoingStateCherubikonBoundary Boundary;
	const bool bResolved = UHyperTwistTrainingRuntimeLibrary::TryGetBundledValidationOngoingStateCherubikonBoundary(
		TEXT("validation-ongoing-state-cherubikon-boundary"),
		Boundary);

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

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

	return true;
}
