#include "HyperTwistTraining/HyperTwistTrainingRuntimeLibrary.h"

#include "Misc/AutomationTest.h"

IMPLEMENT_SIMPLE_AUTOMATION_TEST(
	FHyperTwistValidationPhaseJEEStereobateStatePacketContractTest,
	"HyperTwist.Validation.PhaseJEE.StereobateStatePacketContract",
	EAutomationTestFlags::EditorContext | EAutomationTestFlags::EngineFilter
)

bool FHyperTwistValidationPhaseJEEStereobateStatePacketContractTest::RunTest(const FString& Parameters)
{
	FHyperTwistTrainingValidationStereobateStatePacketContract Contract;
	const bool bResolved = UHyperTwistTrainingRuntimeLibrary::TryGetBundledValidationStereobateStatePacketContract(
		TEXT("validation-stereobate-state-packet-contract"),
		Contract);

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

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

	return true;
}

IMPLEMENT_SIMPLE_AUTOMATION_TEST(
	FHyperTwistValidationPhaseJEEOngoingStateFederationBoundaryTest,
	"HyperTwist.Validation.PhaseJEE.OngoingStateFederationBoundary",
	EAutomationTestFlags::EditorContext | EAutomationTestFlags::EngineFilter
)

bool FHyperTwistValidationPhaseJEEOngoingStateFederationBoundaryTest::RunTest(const FString& Parameters)
{
	FHyperTwistTrainingValidationOngoingStateFederationBoundary Boundary;
	const bool bResolved = UHyperTwistTrainingRuntimeLibrary::TryGetBundledValidationOngoingStateFederationBoundary(
		TEXT("validation-ongoing-state-federation-boundary"),
		Boundary);

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

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

	return true;
}
