#include "HyperTwistTraining/HyperTwistTrainingRuntimeLibrary.h"

#include "Misc/AutomationTest.h"

IMPLEMENT_SIMPLE_AUTOMATION_TEST(
	FHyperTwistValidationPhaseJDOApophygeStatePacketContractTest,
	"HyperTwist.Validation.PhaseJDO.ApophygeStatePacketContract",
	EAutomationTestFlags::EditorContext | EAutomationTestFlags::EngineFilter
)

bool FHyperTwistValidationPhaseJDOApophygeStatePacketContractTest::RunTest(const FString& Parameters)
{
	FHyperTwistTrainingValidationApophygeStatePacketContract Contract;
	const bool bResolved = UHyperTwistTrainingRuntimeLibrary::TryGetBundledValidationApophygeStatePacketContract(
		TEXT("validation-apophyge-state-packet-contract"),
		Contract);

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

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

	return true;
}

IMPLEMENT_SIMPLE_AUTOMATION_TEST(
	FHyperTwistValidationPhaseJDOOngoingStateConvivialityBoundaryTest,
	"HyperTwist.Validation.PhaseJDO.OngoingStateConvivialityBoundary",
	EAutomationTestFlags::EditorContext | EAutomationTestFlags::EngineFilter
)

bool FHyperTwistValidationPhaseJDOOngoingStateConvivialityBoundaryTest::RunTest(const FString& Parameters)
{
	FHyperTwistTrainingValidationOngoingStateConvivialityBoundary Boundary;
	const bool bResolved = UHyperTwistTrainingRuntimeLibrary::TryGetBundledValidationOngoingStateConvivialityBoundary(
		TEXT("validation-ongoing-state-conviviality-boundary"),
		Boundary);

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

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

	return true;
}
