#include "HyperTwistTraining/HyperTwistTrainingRuntimeLibrary.h"

#include "Misc/AutomationTest.h"

IMPLEMENT_SIMPLE_AUTOMATION_TEST(
	FHyperTwistValidationPhaseJCMPedimentStatePacketContractTest,
	"HyperTwist.Validation.PhaseJCM.PedimentStatePacketContract",
	EAutomationTestFlags::EditorContext | EAutomationTestFlags::EngineFilter
)

bool FHyperTwistValidationPhaseJCMPedimentStatePacketContractTest::RunTest(const FString& Parameters)
{
	FHyperTwistTrainingValidationPedimentStatePacketContract Contract;
	const bool bResolved = UHyperTwistTrainingRuntimeLibrary::TryGetBundledValidationPedimentStatePacketContract(
		TEXT("validation-pediment-state-packet-contract"),
		Contract);

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

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

	return true;
}

IMPLEMENT_SIMPLE_AUTOMATION_TEST(
	FHyperTwistValidationPhaseJCMOngoingStateDistinctionBoundaryTest,
	"HyperTwist.Validation.PhaseJCM.OngoingStateDistinctionBoundary",
	EAutomationTestFlags::EditorContext | EAutomationTestFlags::EngineFilter
)

bool FHyperTwistValidationPhaseJCMOngoingStateDistinctionBoundaryTest::RunTest(const FString& Parameters)
{
	FHyperTwistTrainingValidationOngoingStateDistinctionBoundary Boundary;
	const bool bResolved = UHyperTwistTrainingRuntimeLibrary::TryGetBundledValidationOngoingStateDistinctionBoundary(
		TEXT("validation-ongoing-state-distinction-boundary"),
		Boundary);

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

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

	return true;
}
