#include "HyperTwistTraining/HyperTwistTrainingRuntimeLibrary.h"

#include "Misc/AutomationTest.h"

IMPLEMENT_SIMPLE_AUTOMATION_TEST(
	FHyperTwistValidationPhaseJGHFaldaStateLedgerContractTest,
	"HyperTwist.Validation.PhaseJGH.FaldaStateLedgerContract",
	EAutomationTestFlags::EditorContext | EAutomationTestFlags::EngineFilter
)

bool FHyperTwistValidationPhaseJGHFaldaStateLedgerContractTest::RunTest(const FString& Parameters)
{
	FHyperTwistTrainingValidationFaldaStateLedgerContract Contract;
	const bool bResolved = UHyperTwistTrainingRuntimeLibrary::TryGetBundledValidationFaldaStateLedgerContract(
		TEXT("validation-falda-state-ledger-contract"),
		Contract);

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

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

	return true;
}

IMPLEMENT_SIMPLE_AUTOMATION_TEST(
	FHyperTwistValidationPhaseJGHOngoingStateMantumBoundaryTest,
	"HyperTwist.Validation.PhaseJGH.OngoingStateMantumBoundary",
	EAutomationTestFlags::EditorContext | EAutomationTestFlags::EngineFilter
)

bool FHyperTwistValidationPhaseJGHOngoingStateMantumBoundaryTest::RunTest(const FString& Parameters)
{
	FHyperTwistTrainingValidationOngoingStateMantumBoundary Boundary;
	const bool bResolved = UHyperTwistTrainingRuntimeLibrary::TryGetBundledValidationOngoingStateMantumBoundary(
		TEXT("validation-ongoing-state-mantum-boundary"),
		Boundary);

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

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

	return true;
}
