#include "HyperTwistTraining/HyperTwistTrainingRuntimeLibrary.h"

#include "Misc/AutomationTest.h"

IMPLEMENT_SIMPLE_AUTOMATION_TEST(
	FHyperTwistValidationPhaseJFEPatenStatePacketContractTest,
	"HyperTwist.Validation.PhaseJFE.PatenStatePacketContract",
	EAutomationTestFlags::EditorContext | EAutomationTestFlags::EngineFilter
)

bool FHyperTwistValidationPhaseJFEPatenStatePacketContractTest::RunTest(const FString& Parameters)
{
	FHyperTwistTrainingValidationPatenStatePacketContract Contract;
	const bool bResolved = UHyperTwistTrainingRuntimeLibrary::TryGetBundledValidationPatenStatePacketContract(
		TEXT("validation-paten-state-packet-contract"),
		Contract);

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

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

	return true;
}

IMPLEMENT_SIMPLE_AUTOMATION_TEST(
	FHyperTwistValidationPhaseJFEOngoingStateBurseBoundaryTest,
	"HyperTwist.Validation.PhaseJFE.OngoingStateBurseBoundary",
	EAutomationTestFlags::EditorContext | EAutomationTestFlags::EngineFilter
)

bool FHyperTwistValidationPhaseJFEOngoingStateBurseBoundaryTest::RunTest(const FString& Parameters)
{
	FHyperTwistTrainingValidationOngoingStateBurseBoundary Boundary;
	const bool bResolved = UHyperTwistTrainingRuntimeLibrary::TryGetBundledValidationOngoingStateBurseBoundary(
		TEXT("validation-ongoing-state-burse-boundary"),
		Boundary);

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

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

	return true;
}
