#include "HyperTwistTraining/HyperTwistTrainingRuntimeLibrary.h"

#include "Misc/AutomationTest.h"

IMPLEMENT_SIMPLE_AUTOMATION_TEST(
	FHyperTwistValidationPhaseJCUTaeniaStatePacketContractTest,
	"HyperTwist.Validation.PhaseJCU.TaeniaStatePacketContract",
	EAutomationTestFlags::EditorContext | EAutomationTestFlags::EngineFilter
)

bool FHyperTwistValidationPhaseJCUTaeniaStatePacketContractTest::RunTest(const FString& Parameters)
{
	FHyperTwistTrainingValidationTaeniaStatePacketContract Contract;
	const bool bResolved = UHyperTwistTrainingRuntimeLibrary::TryGetBundledValidationTaeniaStatePacketContract(
		TEXT("validation-taenia-state-packet-contract"),
		Contract);

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

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

	return true;
}

IMPLEMENT_SIMPLE_AUTOMATION_TEST(
	FHyperTwistValidationPhaseJCUOngoingStateReverenceBoundaryTest,
	"HyperTwist.Validation.PhaseJCU.OngoingStateReverenceBoundary",
	EAutomationTestFlags::EditorContext | EAutomationTestFlags::EngineFilter
)

bool FHyperTwistValidationPhaseJCUOngoingStateReverenceBoundaryTest::RunTest(const FString& Parameters)
{
	FHyperTwistTrainingValidationOngoingStateReverenceBoundary Boundary;
	const bool bResolved = UHyperTwistTrainingRuntimeLibrary::TryGetBundledValidationOngoingStateReverenceBoundary(
		TEXT("validation-ongoing-state-reverence-boundary"),
		Boundary);

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

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

	return true;
}
