#include "HyperTwistTraining/HyperTwistTrainingRuntimeLibrary.h"

#include "Misc/AutomationTest.h"

IMPLEMENT_SIMPLE_AUTOMATION_TEST(
	FHyperTwistValidationPhaseJCGFootingStatePacketContractTest,
	"HyperTwist.Validation.PhaseJCG.FootingStatePacketContract",
	EAutomationTestFlags::EditorContext | EAutomationTestFlags::EngineFilter
)

bool FHyperTwistValidationPhaseJCGFootingStatePacketContractTest::RunTest(const FString& Parameters)
{
	FHyperTwistTrainingValidationFootingStatePacketContract Contract;
	const bool bResolved = UHyperTwistTrainingRuntimeLibrary::TryGetBundledValidationFootingStatePacketContract(
		TEXT("validation-footing-state-packet-contract"),
		Contract);

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

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

	return true;
}

IMPLEMENT_SIMPLE_AUTOMATION_TEST(
	FHyperTwistValidationPhaseJCGOngoingStateHomageBoundaryTest,
	"HyperTwist.Validation.PhaseJCG.OngoingStateHomageBoundary",
	EAutomationTestFlags::EditorContext | EAutomationTestFlags::EngineFilter
)

bool FHyperTwistValidationPhaseJCGOngoingStateHomageBoundaryTest::RunTest(const FString& Parameters)
{
	FHyperTwistTrainingValidationOngoingStateHomageBoundary Boundary;
	const bool bResolved = UHyperTwistTrainingRuntimeLibrary::TryGetBundledValidationOngoingStateHomageBoundary(
		TEXT("validation-ongoing-state-homage-boundary"),
		Boundary);

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

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

	return true;
}
