#include "HyperTwistTraining/HyperTwistTrainingRuntimeLibrary.h"

#include "Misc/AutomationTest.h"

IMPLEMENT_SIMPLE_AUTOMATION_TEST(
	FHyperTwistValidationPhaseJFPOstensoriumStateLedgerContractTest,
	"HyperTwist.Validation.PhaseJFP.OstensoriumStateLedgerContract",
	EAutomationTestFlags::EditorContext | EAutomationTestFlags::EngineFilter
)

bool FHyperTwistValidationPhaseJFPOstensoriumStateLedgerContractTest::RunTest(const FString& Parameters)
{
	FHyperTwistTrainingValidationOstensoriumStateLedgerContract Contract;
	const bool bResolved = UHyperTwistTrainingRuntimeLibrary::TryGetBundledValidationOstensoriumStateLedgerContract(
		TEXT("validation-ostensorium-state-ledger-contract"),
		Contract);

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

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

	return true;
}

IMPLEMENT_SIMPLE_AUTOMATION_TEST(
	FHyperTwistValidationPhaseJFPOngoingStateVelumBoundaryTest,
	"HyperTwist.Validation.PhaseJFP.OngoingStateVelumBoundary",
	EAutomationTestFlags::EditorContext | EAutomationTestFlags::EngineFilter
)

bool FHyperTwistValidationPhaseJFPOngoingStateVelumBoundaryTest::RunTest(const FString& Parameters)
{
	FHyperTwistTrainingValidationOngoingStateVelumBoundary Boundary;
	const bool bResolved = UHyperTwistTrainingRuntimeLibrary::TryGetBundledValidationOngoingStateVelumBoundary(
		TEXT("validation-ongoing-state-velum-boundary"),
		Boundary);

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

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

	return true;
}
