#include "HyperTwistTraining/HyperTwistTrainingRuntimeLibrary.h"

#include "Misc/AutomationTest.h"

IMPLEMENT_SIMPLE_AUTOMATION_TEST(
	FHyperTwistValidationPhaseJDKListelStatePacketContractTest,
	"HyperTwist.Validation.PhaseJDK.ListelStatePacketContract",
	EAutomationTestFlags::EditorContext | EAutomationTestFlags::EngineFilter
)

bool FHyperTwistValidationPhaseJDKListelStatePacketContractTest::RunTest(const FString& Parameters)
{
	FHyperTwistTrainingValidationListelStatePacketContract Contract;
	const bool bResolved = UHyperTwistTrainingRuntimeLibrary::TryGetBundledValidationListelStatePacketContract(
		TEXT("validation-listel-state-packet-contract"),
		Contract);

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

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

	return true;
}

IMPLEMENT_SIMPLE_AUTOMATION_TEST(
	FHyperTwistValidationPhaseJDKOngoingStateMerrimentBoundaryTest,
	"HyperTwist.Validation.PhaseJDK.OngoingStateMerrimentBoundary",
	EAutomationTestFlags::EditorContext | EAutomationTestFlags::EngineFilter
)

bool FHyperTwistValidationPhaseJDKOngoingStateMerrimentBoundaryTest::RunTest(const FString& Parameters)
{
	FHyperTwistTrainingValidationOngoingStateMerrimentBoundary Boundary;
	const bool bResolved = UHyperTwistTrainingRuntimeLibrary::TryGetBundledValidationOngoingStateMerrimentBoundary(
		TEXT("validation-ongoing-state-merriment-boundary"),
		Boundary);

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

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

	return true;
}
