#include "HyperTwistTraining/HyperTwistTrainingRuntimeLibrary.h"

#include "Misc/AutomationTest.h"

IMPLEMENT_SIMPLE_AUTOMATION_TEST(
	FHyperTwistValidationPhaseJGSEngolpionStateLedgerContractTest,
	"HyperTwist.Validation.PhaseJGS.EngolpionStateLedgerContract",
	EAutomationTestFlags::EditorContext | EAutomationTestFlags::EngineFilter
)

bool FHyperTwistValidationPhaseJGSEngolpionStateLedgerContractTest::RunTest(const FString& Parameters)
{
	FHyperTwistTrainingValidationEngolpionStateLedgerContract Contract;
	const bool bResolved = UHyperTwistTrainingRuntimeLibrary::TryGetBundledValidationEngolpionStateLedgerContract(
		TEXT("validation-engolpion-state-ledger-contract"),
		Contract);

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

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

	return true;
}

IMPLEMENT_SIMPLE_AUTOMATION_TEST(
	FHyperTwistValidationPhaseJGSOngoingStatePanagiaBoundaryTest,
	"HyperTwist.Validation.PhaseJGS.OngoingStatePanagiaBoundary",
	EAutomationTestFlags::EditorContext | EAutomationTestFlags::EngineFilter
)

bool FHyperTwistValidationPhaseJGSOngoingStatePanagiaBoundaryTest::RunTest(const FString& Parameters)
{
	FHyperTwistTrainingValidationOngoingStatePanagiaBoundary Boundary;
	const bool bResolved = UHyperTwistTrainingRuntimeLibrary::TryGetBundledValidationOngoingStatePanagiaBoundary(
		TEXT("validation-ongoing-state-panagia-boundary"),
		Boundary);

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

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

	return true;
}
