#include "HyperTwistTraining/HyperTwistTrainingRuntimeLibrary.h"

#include "Misc/AutomationTest.h"

IMPLEMENT_SIMPLE_AUTOMATION_TEST(
	FHyperTwistValidationPhaseJGFGaleroStateLedgerContractTest,
	"HyperTwist.Validation.PhaseJGF.GaleroStateLedgerContract",
	EAutomationTestFlags::EditorContext | EAutomationTestFlags::EngineFilter
)

bool FHyperTwistValidationPhaseJGFGaleroStateLedgerContractTest::RunTest(const FString& Parameters)
{
	FHyperTwistTrainingValidationGaleroStateLedgerContract Contract;
	const bool bResolved = UHyperTwistTrainingRuntimeLibrary::TryGetBundledValidationGaleroStateLedgerContract(
		TEXT("validation-galero-state-ledger-contract"),
		Contract);

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

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

	return true;
}

IMPLEMENT_SIMPLE_AUTOMATION_TEST(
	FHyperTwistValidationPhaseJFGOngoingStateSimarBoundaryTest,
	"HyperTwist.Validation.PhaseJGF.OngoingStateSimarBoundary",
	EAutomationTestFlags::EditorContext | EAutomationTestFlags::EngineFilter
)

bool FHyperTwistValidationPhaseJFGOngoingStateSimarBoundaryTest::RunTest(const FString& Parameters)
{
	FHyperTwistTrainingValidationOngoingStateSimarBoundary Boundary;
	const bool bResolved = UHyperTwistTrainingRuntimeLibrary::TryGetBundledValidationOngoingStateSimarBoundary(
		TEXT("validation-ongoing-state-simar-boundary"),
		Boundary);

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

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

	return true;
}
