#include "HyperTwistTraining/HyperTwistTrainingRuntimeLibrary.h"

#include "Misc/AutomationTest.h"

IMPLEMENT_SIMPLE_AUTOMATION_TEST(
	FHyperTwistValidationPhaseJDLCinctureStateLedgerContractTest,
	"HyperTwist.Validation.PhaseJDL.CinctureStateLedgerContract",
	EAutomationTestFlags::EditorContext | EAutomationTestFlags::EngineFilter
)

bool FHyperTwistValidationPhaseJDLCinctureStateLedgerContractTest::RunTest(const FString& Parameters)
{
	FHyperTwistTrainingValidationCinctureStateLedgerContract Contract;
	const bool bResolved = UHyperTwistTrainingRuntimeLibrary::TryGetBundledValidationCinctureStateLedgerContract(
		TEXT("validation-cincture-state-ledger-contract"),
		Contract);

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

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

	return true;
}

IMPLEMENT_SIMPLE_AUTOMATION_TEST(
	FHyperTwistValidationPhaseJDLOngoingStateGaietyBoundaryTest,
	"HyperTwist.Validation.PhaseJDL.OngoingStateGaietyBoundary",
	EAutomationTestFlags::EditorContext | EAutomationTestFlags::EngineFilter
)

bool FHyperTwistValidationPhaseJDLOngoingStateGaietyBoundaryTest::RunTest(const FString& Parameters)
{
	FHyperTwistTrainingValidationOngoingStateGaietyBoundary Boundary;
	const bool bResolved = UHyperTwistTrainingRuntimeLibrary::TryGetBundledValidationOngoingStateGaietyBoundary(
		TEXT("validation-ongoing-state-gaiety-boundary"),
		Boundary);

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

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

	return true;
}
