#include "HyperTwistTraining/HyperTwistTrainingRuntimeLibrary.h"

#include "Misc/AutomationTest.h"

IMPLEMENT_SIMPLE_AUTOMATION_TEST(
	FHyperTwistValidationPhaseJCKFriezeStatePacketContractTest,
	"HyperTwist.Validation.PhaseJCK.FriezeStatePacketContract",
	EAutomationTestFlags::EditorContext | EAutomationTestFlags::EngineFilter
)

bool FHyperTwistValidationPhaseJCKFriezeStatePacketContractTest::RunTest(const FString& Parameters)
{
	FHyperTwistTrainingValidationFriezeStatePacketContract Contract;
	const bool bResolved = UHyperTwistTrainingRuntimeLibrary::TryGetBundledValidationFriezeStatePacketContract(
		TEXT("validation-frieze-state-packet-contract"),
		Contract);

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

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

	return true;
}

IMPLEMENT_SIMPLE_AUTOMATION_TEST(
	FHyperTwistValidationPhaseJCKOngoingStateLaurelBoundaryTest,
	"HyperTwist.Validation.PhaseJCK.OngoingStateLaurelBoundary",
	EAutomationTestFlags::EditorContext | EAutomationTestFlags::EngineFilter
)

bool FHyperTwistValidationPhaseJCKOngoingStateLaurelBoundaryTest::RunTest(const FString& Parameters)
{
	FHyperTwistTrainingValidationOngoingStateLaurelBoundary Boundary;
	const bool bResolved = UHyperTwistTrainingRuntimeLibrary::TryGetBundledValidationOngoingStateLaurelBoundary(
		TEXT("validation-ongoing-state-laurel-boundary"),
		Boundary);

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

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

	return true;
}
