#include "HyperTwistTraining/HyperTwistTrainingRuntimeLibrary.h"

#include "Misc/AutomationTest.h"

IMPLEMENT_SIMPLE_AUTOMATION_TEST(
	FHyperTwistValidationPhaseJGQAnalavosStateLedgerContractTest,
	"HyperTwist.Validation.PhaseJGQ.AnalavosStateLedgerContract",
	EAutomationTestFlags::EditorContext | EAutomationTestFlags::EngineFilter
)

bool FHyperTwistValidationPhaseJGQAnalavosStateLedgerContractTest::RunTest(const FString& Parameters)
{
	FHyperTwistTrainingValidationAnalavosStateLedgerContract Contract;
	const bool bResolved = UHyperTwistTrainingRuntimeLibrary::TryGetBundledValidationAnalavosStateLedgerContract(
		TEXT("validation-analavos-state-ledger-contract"),
		Contract);

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

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

	return true;
}

IMPLEMENT_SIMPLE_AUTOMATION_TEST(
	FHyperTwistValidationPhaseJGQOngoingStatePolystavrionBoundaryTest,
	"HyperTwist.Validation.PhaseJGQ.OngoingStatePolystavrionBoundary",
	EAutomationTestFlags::EditorContext | EAutomationTestFlags::EngineFilter
)

bool FHyperTwistValidationPhaseJGQOngoingStatePolystavrionBoundaryTest::RunTest(const FString& Parameters)
{
	FHyperTwistTrainingValidationOngoingStatePolystavrionBoundary Boundary;
	const bool bResolved = UHyperTwistTrainingRuntimeLibrary::TryGetBundledValidationOngoingStatePolystavrionBoundary(
		TEXT("validation-ongoing-state-polystavrion-boundary"),
		Boundary);

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

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

	return true;
}
