#include "HyperTwistTraining/HyperTwistTrainingRuntimeLibrary.h"

#include "Misc/AutomationTest.h"

IMPLEMENT_SIMPLE_AUTOMATION_TEST(
	FHyperTwistValidationPhaseJDETorusStatePacketContractTest,
	"HyperTwist.Validation.PhaseJDE.TorusStatePacketContract",
	EAutomationTestFlags::EditorContext | EAutomationTestFlags::EngineFilter
)

bool FHyperTwistValidationPhaseJDETorusStatePacketContractTest::RunTest(const FString& Parameters)
{
	FHyperTwistTrainingValidationTorusStatePacketContract Contract;
	const bool bResolved = UHyperTwistTrainingRuntimeLibrary::TryGetBundledValidationTorusStatePacketContract(
		TEXT("validation-torus-state-packet-contract"),
		Contract);

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

	TestEqual(
		TEXT("The validation torus-state packet contract id must stay stable."),
		Contract.ContractId,
		FString(TEXT("validation-torus-state-packet-contract")));
	TestTrue(
		TEXT("The validation torus-state packet contract must preserve benchmark-drift torus packets."),
		Contract.PacketIds.Contains(TEXT("torus-state-packet/benchmark-drift-torus")));
	TestTrue(
		TEXT("The validation torus-state packet contract must preserve the bounded torus-state packet surface."),
		Contract.PacketSurfaceTags.Contains(TEXT("bounded torus-state packet")));
	TestTrue(
		TEXT("The validation torus-state packet contract must preserve the no-generic-torus-state-platform guard."),
		Contract.TorusGuardTags.Contains(TEXT("no-generic-torus-state-platform guard")));
	TestTrue(
		TEXT("The validation torus-state packet contract must keep generic torus-state platform ownership excluded."),
		Contract.ExplicitExclusions.Contains(TEXT("generic torus-state platform ownership")));

	return true;
}

IMPLEMENT_SIMPLE_AUTOMATION_TEST(
	FHyperTwistValidationPhaseJDEOngoingStateExultationBoundaryTest,
	"HyperTwist.Validation.PhaseJDE.OngoingStateExultationBoundary",
	EAutomationTestFlags::EditorContext | EAutomationTestFlags::EngineFilter
)

bool FHyperTwistValidationPhaseJDEOngoingStateExultationBoundaryTest::RunTest(const FString& Parameters)
{
	FHyperTwistTrainingValidationOngoingStateExultationBoundary Boundary;
	const bool bResolved = UHyperTwistTrainingRuntimeLibrary::TryGetBundledValidationOngoingStateExultationBoundary(
		TEXT("validation-ongoing-state-exultation-boundary"),
		Boundary);

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

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

	return true;
}
