#include "HyperTwistTraining/HyperTwistTrainingRuntimeLibrary.h"

#include "Misc/AutomationTest.h"

IMPLEMENT_SIMPLE_AUTOMATION_TEST(
	FHyperTwistValidationPhaseJCNEntablatureStateLedgerContractTest,
	"HyperTwist.Validation.PhaseJCN.EntablatureStateLedgerContract",
	EAutomationTestFlags::EditorContext | EAutomationTestFlags::EngineFilter
)

bool FHyperTwistValidationPhaseJCNEntablatureStateLedgerContractTest::RunTest(const FString& Parameters)
{
	FHyperTwistTrainingValidationEntablatureStateLedgerContract Contract;
	const bool bResolved = UHyperTwistTrainingRuntimeLibrary::TryGetBundledValidationEntablatureStateLedgerContract(
		TEXT("validation-entablature-state-ledger-contract"),
		Contract);

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

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

	return true;
}

IMPLEMENT_SIMPLE_AUTOMATION_TEST(
	FHyperTwistValidationPhaseJCNOngoingStateRecognitionBoundaryTest,
	"HyperTwist.Validation.PhaseJCN.OngoingStateRecognitionBoundary",
	EAutomationTestFlags::EditorContext | EAutomationTestFlags::EngineFilter
)

bool FHyperTwistValidationPhaseJCNOngoingStateRecognitionBoundaryTest::RunTest(const FString& Parameters)
{
	FHyperTwistTrainingValidationOngoingStateRecognitionBoundary Boundary;
	const bool bResolved = UHyperTwistTrainingRuntimeLibrary::TryGetBundledValidationOngoingStateRecognitionBoundary(
		TEXT("validation-ongoing-state-recognition-boundary"),
		Boundary);

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

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

	return true;
}
