#include "HyperTwistTraining/HyperTwistTrainingRuntimeLibrary.h"

#include "Misc/AutomationTest.h"

IMPLEMENT_SIMPLE_AUTOMATION_TEST(
	FHyperTwistValidationPhaseJGCCamauroStateLedgerContractTest,
	"HyperTwist.Validation.PhaseJGC.CamauroStateLedgerContract",
	EAutomationTestFlags::EditorContext | EAutomationTestFlags::EngineFilter
)

bool FHyperTwistValidationPhaseJGCCamauroStateLedgerContractTest::RunTest(const FString& Parameters)
{
	FHyperTwistTrainingValidationCamauroStateLedgerContract Contract;
	const bool bResolved = UHyperTwistTrainingRuntimeLibrary::TryGetBundledValidationCamauroStateLedgerContract(
		TEXT("validation-camauro-state-ledger-contract"),
		Contract);

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

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

	return true;
}

IMPLEMENT_SIMPLE_AUTOMATION_TEST(
	FHyperTwistValidationPhaseJGCOngoingStateSaturnoBoundaryTest,
	"HyperTwist.Validation.PhaseJGC.OngoingStateSaturnoBoundary",
	EAutomationTestFlags::EditorContext | EAutomationTestFlags::EngineFilter
)

bool FHyperTwistValidationPhaseJGCOngoingStateSaturnoBoundaryTest::RunTest(const FString& Parameters)
{
	FHyperTwistTrainingValidationOngoingStateSaturnoBoundary Boundary;
	const bool bResolved = UHyperTwistTrainingRuntimeLibrary::TryGetBundledValidationOngoingStateSaturnoBoundary(
		TEXT("validation-ongoing-state-saturno-boundary"),
		Boundary);

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

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

	return true;
}
