#include "HyperTwistTraining/HyperTwistTrainingRuntimeLibrary.h"

#include "Misc/AutomationTest.h"

IMPLEMENT_SIMPLE_AUTOMATION_TEST(
	FHyperTwistValidationPhaseJGURipidionStateLedgerContractTest,
	"HyperTwist.Validation.PhaseJGU.RipidionStateLedgerContract",
	EAutomationTestFlags::EditorContext | EAutomationTestFlags::EngineFilter
)

bool FHyperTwistValidationPhaseJGURipidionStateLedgerContractTest::RunTest(const FString& Parameters)
{
	FHyperTwistTrainingValidationRipidionStateLedgerContract Contract;
	const bool bResolved = UHyperTwistTrainingRuntimeLibrary::TryGetBundledValidationRipidionStateLedgerContract(
		TEXT("validation-ripidion-state-ledger-contract"),
		Contract);

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

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

	return true;
}

IMPLEMENT_SIMPLE_AUTOMATION_TEST(
	FHyperTwistValidationPhaseJGUOngoingStateAsteriskosBoundaryTest,
	"HyperTwist.Validation.PhaseJGU.OngoingStateAsteriskosBoundary",
	EAutomationTestFlags::EditorContext | EAutomationTestFlags::EngineFilter
)

bool FHyperTwistValidationPhaseJGUOngoingStateAsteriskosBoundaryTest::RunTest(const FString& Parameters)
{
	FHyperTwistTrainingValidationOngoingStateAsteriskosBoundary Boundary;
	const bool bResolved = UHyperTwistTrainingRuntimeLibrary::TryGetBundledValidationOngoingStateAsteriskosBoundary(
		TEXT("validation-ongoing-state-asteriskos-boundary"),
		Boundary);

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

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

	return true;
}
