#include "HyperTwistTraining/HyperTwistTrainingRuntimeLibrary.h"

#include "Misc/AutomationTest.h"

IMPLEMENT_SIMPLE_AUTOMATION_TEST(
	FHyperTwistValidationPhaseJGXAerStateLedgerContractTest,
	"HyperTwist.Validation.PhaseJGX.AerStateLedgerContract",
	EAutomationTestFlags::EditorContext | EAutomationTestFlags::EngineFilter
)

bool FHyperTwistValidationPhaseJGXAerStateLedgerContractTest::RunTest(const FString& Parameters)
{
	FHyperTwistTrainingValidationAerStateLedgerContract Contract;
	const bool bResolved = UHyperTwistTrainingRuntimeLibrary::TryGetBundledValidationAerStateLedgerContract(
		TEXT("validation-aer-state-ledger-contract"),
		Contract);

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

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

	return true;
}

IMPLEMENT_SIMPLE_AUTOMATION_TEST(
	FHyperTwistValidationPhaseJGXOngoingStateLabisBoundaryTest,
	"HyperTwist.Validation.PhaseJGX.OngoingStateLabisBoundary",
	EAutomationTestFlags::EditorContext | EAutomationTestFlags::EngineFilter
)

bool FHyperTwistValidationPhaseJGXOngoingStateLabisBoundaryTest::RunTest(const FString& Parameters)
{
	FHyperTwistTrainingValidationOngoingStateLabisBoundary Boundary;
	const bool bResolved = UHyperTwistTrainingRuntimeLibrary::TryGetBundledValidationOngoingStateLabisBoundary(
		TEXT("validation-ongoing-state-labis-boundary"),
		Boundary);

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

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

	return true;
}
