#include "HyperTwistTraining/HyperTwistTrainingRuntimeLibrary.h"

#include "Misc/AutomationTest.h"

IMPLEMENT_SIMPLE_AUTOMATION_TEST(
	FHyperTwistValidationPhaseJFWPectoralCrossStateLedgerContractTest,
	"HyperTwist.Validation.PhaseJFW.PectoralCrossStateLedgerContract",
	EAutomationTestFlags::EditorContext | EAutomationTestFlags::EngineFilter
)

bool FHyperTwistValidationPhaseJFWPectoralCrossStateLedgerContractTest::RunTest(const FString& Parameters)
{
	FHyperTwistTrainingValidationPectoralCrossStateLedgerContract Contract;
	const bool bResolved = UHyperTwistTrainingRuntimeLibrary::TryGetBundledValidationPectoralCrossStateLedgerContract(
		TEXT("validation-pectoral-cross-state-ledger-contract"),
		Contract);

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

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

	return true;
}

IMPLEMENT_SIMPLE_AUTOMATION_TEST(
	FHyperTwistValidationPhaseJFWOngoingStateRingBoundaryTest,
	"HyperTwist.Validation.PhaseJFW.OngoingStateRingBoundary",
	EAutomationTestFlags::EditorContext | EAutomationTestFlags::EngineFilter
)

bool FHyperTwistValidationPhaseJFWOngoingStateRingBoundaryTest::RunTest(const FString& Parameters)
{
	FHyperTwistTrainingValidationOngoingStateRingBoundary Boundary;
	const bool bResolved = UHyperTwistTrainingRuntimeLibrary::TryGetBundledValidationOngoingStateRingBoundary(
		TEXT("validation-ongoing-state-ring-boundary"),
		Boundary);

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

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

	return true;
}
