#include "HyperTwistTraining/HyperTwistTrainingRuntimeLibrary.h"

#include "Misc/AutomationTest.h"

IMPLEMENT_SIMPLE_AUTOMATION_TEST(
	FHyperTwistValidationPhaseJDITrochilusStatePacketContractTest,
	"HyperTwist.Validation.PhaseJDI.TrochilusStatePacketContract",
	EAutomationTestFlags::EditorContext | EAutomationTestFlags::EngineFilter
)

bool FHyperTwistValidationPhaseJDITrochilusStatePacketContractTest::RunTest(const FString& Parameters)
{
	FHyperTwistTrainingValidationTrochilusStatePacketContract Contract;
	const bool bResolved = UHyperTwistTrainingRuntimeLibrary::TryGetBundledValidationTrochilusStatePacketContract(
		TEXT("validation-trochilus-state-packet-contract"),
		Contract);

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

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

	return true;
}

IMPLEMENT_SIMPLE_AUTOMATION_TEST(
	FHyperTwistValidationPhaseJDIOngoingStateCheerBoundaryTest,
	"HyperTwist.Validation.PhaseJDI.OngoingStateCheerBoundary",
	EAutomationTestFlags::EditorContext | EAutomationTestFlags::EngineFilter
)

bool FHyperTwistValidationPhaseJDIOngoingStateCheerBoundaryTest::RunTest(const FString& Parameters)
{
	FHyperTwistTrainingValidationOngoingStateCheerBoundary Boundary;
	const bool bResolved = UHyperTwistTrainingRuntimeLibrary::TryGetBundledValidationOngoingStateCheerBoundary(
		TEXT("validation-ongoing-state-cheer-boundary"),
		Boundary);

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

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

	return true;
}
