#include "HyperTwistTraining/HyperTwistTrainingRuntimeLibrary.h"

#include "Misc/AutomationTest.h"

IMPLEMENT_SIMPLE_AUTOMATION_TEST(
	FHyperTwistValidationPhaseJFCCorporalStatePacketContractTest,
	"HyperTwist.Validation.PhaseJFC.CorporalStatePacketContract",
	EAutomationTestFlags::EditorContext | EAutomationTestFlags::EngineFilter
)

bool FHyperTwistValidationPhaseJFCCorporalStatePacketContractTest::RunTest(const FString& Parameters)
{
	FHyperTwistTrainingValidationCorporalStatePacketContract Contract;
	const bool bResolved = UHyperTwistTrainingRuntimeLibrary::TryGetBundledValidationCorporalStatePacketContract(
		TEXT("validation-corporal-state-packet-contract"),
		Contract);

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

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

	return true;
}

IMPLEMENT_SIMPLE_AUTOMATION_TEST(
	FHyperTwistValidationPhaseJFCOngoingStatePallBoundaryTest,
	"HyperTwist.Validation.PhaseJFC.OngoingStatePallBoundary",
	EAutomationTestFlags::EditorContext | EAutomationTestFlags::EngineFilter
)

bool FHyperTwistValidationPhaseJFCOngoingStatePallBoundaryTest::RunTest(const FString& Parameters)
{
	FHyperTwistTrainingValidationOngoingStatePallBoundary Boundary;
	const bool bResolved = UHyperTwistTrainingRuntimeLibrary::TryGetBundledValidationOngoingStatePallBoundary(
		TEXT("validation-ongoing-state-pall-boundary"),
		Boundary);

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

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

	return true;
}
