#include "HyperTwistTraining/HyperTwistTrainingRuntimeLibrary.h"

#include "Misc/AutomationTest.h"

IMPLEMENT_SIMPLE_AUTOMATION_TEST(
	FHyperTwistValidationPhaseJCXCoronaStateLedgerContractTest,
	"HyperTwist.Validation.PhaseJCX.CoronaStateLedgerContract",
	EAutomationTestFlags::EditorContext | EAutomationTestFlags::EngineFilter
)

bool FHyperTwistValidationPhaseJCXCoronaStateLedgerContractTest::RunTest(const FString& Parameters)
{
	FHyperTwistTrainingValidationCoronaStateLedgerContract Contract;
	const bool bResolved = UHyperTwistTrainingRuntimeLibrary::TryGetBundledValidationCoronaStateLedgerContract(
		TEXT("validation-corona-state-ledger-contract"),
		Contract);

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

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

	return true;
}

IMPLEMENT_SIMPLE_AUTOMATION_TEST(
	FHyperTwistValidationPhaseJCXOngoingStateAdorationBoundaryTest,
	"HyperTwist.Validation.PhaseJCX.OngoingStateAdorationBoundary",
	EAutomationTestFlags::EditorContext | EAutomationTestFlags::EngineFilter
)

bool FHyperTwistValidationPhaseJCXOngoingStateAdorationBoundaryTest::RunTest(const FString& Parameters)
{
	FHyperTwistTrainingValidationOngoingStateAdorationBoundary Boundary;
	const bool bResolved = UHyperTwistTrainingRuntimeLibrary::TryGetBundledValidationOngoingStateAdorationBoundary(
		TEXT("validation-ongoing-state-adoration-boundary"),
		Boundary);

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

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

	return true;
}
