#include "HyperTwistTraining/HyperTwistTrainingRuntimeLibrary.h"

#include "Misc/AutomationTest.h"

IMPLEMENT_SIMPLE_AUTOMATION_TEST(
	FHyperTwistValidationPhaseJFGCruetStatePacketContractTest,
	"HyperTwist.Validation.PhaseJFG.CruetStatePacketContract",
	EAutomationTestFlags::EditorContext | EAutomationTestFlags::EngineFilter
)

bool FHyperTwistValidationPhaseJFGCruetStatePacketContractTest::RunTest(const FString& Parameters)
{
	FHyperTwistTrainingValidationCruetStatePacketContract Contract;
	const bool bResolved = UHyperTwistTrainingRuntimeLibrary::TryGetBundledValidationCruetStatePacketContract(
		TEXT("validation-cruet-state-packet-contract"),
		Contract);

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

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

	return true;
}

IMPLEMENT_SIMPLE_AUTOMATION_TEST(
	FHyperTwistValidationPhaseJFGOngoingStateLavaboBoundaryTest,
	"HyperTwist.Validation.PhaseJFG.OngoingStateLavaboBoundary",
	EAutomationTestFlags::EditorContext | EAutomationTestFlags::EngineFilter
)

bool FHyperTwistValidationPhaseJFGOngoingStateLavaboBoundaryTest::RunTest(const FString& Parameters)
{
	FHyperTwistTrainingValidationOngoingStateLavaboBoundary Boundary;
	const bool bResolved = UHyperTwistTrainingRuntimeLibrary::TryGetBundledValidationOngoingStateLavaboBoundary(
		TEXT("validation-ongoing-state-lavabo-boundary"),
		Boundary);

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

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

	return true;
}
