#include "HyperTwistTraining/HyperTwistTrainingRuntimeLibrary.h"

#include "Misc/AutomationTest.h"

IMPLEMENT_SIMPLE_AUTOMATION_TEST(
	FHyperTwistValidationPhaseJGYDiskarionStateLedgerContractTest,
	"HyperTwist.Validation.PhaseJGY.DiskarionStateLedgerContract",
	EAutomationTestFlags::EditorContext | EAutomationTestFlags::EngineFilter
)

bool FHyperTwistValidationPhaseJGYDiskarionStateLedgerContractTest::RunTest(const FString& Parameters)
{
	FHyperTwistTrainingValidationDiskarionStateLedgerContract Contract;
	const bool bResolved = UHyperTwistTrainingRuntimeLibrary::TryGetBundledValidationDiskarionStateLedgerContract(
		TEXT("validation-diskarion-state-ledger-contract"),
		Contract);

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

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

	return true;
}

IMPLEMENT_SIMPLE_AUTOMATION_TEST(
	FHyperTwistValidationPhaseJGYOngoingStateZeonBoundaryTest,
	"HyperTwist.Validation.PhaseJGY.OngoingStateZeonBoundary",
	EAutomationTestFlags::EditorContext | EAutomationTestFlags::EngineFilter
)

bool FHyperTwistValidationPhaseJGYOngoingStateZeonBoundaryTest::RunTest(const FString& Parameters)
{
	FHyperTwistTrainingValidationOngoingStateZeonBoundary Boundary;
	const bool bResolved = UHyperTwistTrainingRuntimeLibrary::TryGetBundledValidationOngoingStateZeonBoundary(
		TEXT("validation-ongoing-state-zeon-boundary"),
		Boundary);

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

	TestEqual(
		TEXT("The validation ongoing-state zeon boundary id must stay stable."),
		Boundary.BoundaryId,
		FString(TEXT("validation-ongoing-state-zeon-boundary")));
	TestTrue(
		TEXT("The validation ongoing-state zeon boundary must preserve reviewer-waiver zeon anchors."),
		Boundary.ZeonIds.Contains(TEXT("ongoing-zeon/reviewer-waiver-zeon")));
	TestTrue(
		TEXT("The validation ongoing-state zeon boundary must preserve the bounded ongoing-state zeon surface."),
		Boundary.ZeonSurfaceTags.Contains(TEXT("bounded ongoing-state zeon")));
	TestTrue(
		TEXT("The validation ongoing-state zeon boundary must preserve the no-generic-ongoing-zeon-platform guard."),
		Boundary.ZeonGuardTags.Contains(TEXT("no-generic-ongoing-zeon-platform guard")));
	TestTrue(
		TEXT("The validation ongoing-state zeon boundary must keep generic ongoing zeon platform ownership excluded."),
		Boundary.ExplicitExclusions.Contains(TEXT("generic ongoing zeon platform ownership")));

	return true;
}
