// Copyright HyperTwist, Inc. All Rights Reserved.

#include "Misc/AutomationTest.h"

#include "HyperTwistTraining/HyperTwistTrainingRuntimeLibrary.h"

#if WITH_AUTOMATION_TESTS

IMPLEMENT_SIMPLE_AUTOMATION_TEST(
	FHyperTwistValidationPhaseJAOTwistedStatePacketContractTest,
	"HyperTwist.FirstParty.Validation.PhaseJAO.TwistedStatePackets",
	EAutomationTestFlags::EditorContext | EAutomationTestFlags::EngineFilter
)

bool FHyperTwistValidationPhaseJAOTwistedStatePacketContractTest::RunTest(const FString& Parameters)
{
	FHyperTwistTrainingValidationTwistedStatePacketContract Contract;
	TestTrue(
		TEXT("The validation twisted-state packet contract must resolve from the runtime library."),
		UHyperTwistTrainingRuntimeLibrary::TryGetBundledValidationTwistedStatePacketContract(
			TEXT("validation-twisted-state-packet-contract"),
			Contract
		)
	);
	TestEqual(
		TEXT("The validation twisted-state packet contract id must stay stable."),
		Contract.ContractId,
		TEXT("validation-twisted-state-packet-contract")
	);
	TestTrue(
		TEXT("The validation twisted-state packet contract must preserve benchmark-drift twisted packets."),
		Contract.PacketIds.Contains(TEXT("twisted-state-packet/benchmark-drift-twisted"))
	);
	TestTrue(
		TEXT("The validation twisted-state packet contract must preserve the bounded twisted-state packet surface."),
		Contract.PacketSurfaceTags.Contains(TEXT("bounded twisted-state packet"))
	);
	TestTrue(
		TEXT("The validation twisted-state packet contract must preserve the no-generic-twisted-state-platform guard."),
		Contract.TwistedGuardTags.Contains(TEXT("no-generic-twisted-state-platform guard"))
	);
	TestTrue(
		TEXT("The validation twisted-state packet contract must keep generic twisted-state platform ownership excluded."),
		Contract.ExplicitExclusions.Contains(TEXT("generic twisted-state platform ownership"))
	);
	return true;
}

IMPLEMENT_SIMPLE_AUTOMATION_TEST(
	FHyperTwistValidationPhaseJAOOngoingStateReflectionBoundaryTest,
	"HyperTwist.FirstParty.Validation.PhaseJAO.OngoingStateReflections",
	EAutomationTestFlags::EditorContext | EAutomationTestFlags::EngineFilter
)

bool FHyperTwistValidationPhaseJAOOngoingStateReflectionBoundaryTest::RunTest(const FString& Parameters)
{
	FHyperTwistTrainingValidationOngoingStateReflectionBoundary Boundary;
	TestTrue(
		TEXT("The validation ongoing-state reflection boundary must resolve from the runtime library."),
		UHyperTwistTrainingRuntimeLibrary::TryGetBundledValidationOngoingStateReflectionBoundary(
			TEXT("validation-ongoing-state-reflection-boundary"),
			Boundary
		)
	);
	TestEqual(
		TEXT("The validation ongoing-state reflection boundary id must stay stable."),
		Boundary.BoundaryId,
		TEXT("validation-ongoing-state-reflection-boundary")
	);
	TestTrue(
		TEXT("The validation ongoing-state reflection boundary must preserve manual-waiver reflections."),
		Boundary.ReflectionIds.Contains(TEXT("ongoing-reflection/manual-waiver-reflected"))
	);
	TestTrue(
		TEXT("The validation ongoing-state reflection boundary must preserve the bounded ongoing-state reflection surface."),
		Boundary.ReflectionSurfaceTags.Contains(TEXT("bounded ongoing-state reflection"))
	);
	TestTrue(
		TEXT("The validation ongoing-state reflection boundary must preserve the no-generic-ongoing-reflection-platform guard."),
		Boundary.ReflectionGuardTags.Contains(TEXT("no-generic-ongoing-reflection-platform guard"))
	);
	TestTrue(
		TEXT("The validation ongoing-state reflection boundary must keep generic ongoing reflection platform ownership excluded."),
		Boundary.ExplicitExclusions.Contains(TEXT("generic ongoing reflection platform ownership"))
	);
	return true;
}

#endif
