#include "HyperTwistTraining/HyperTwistTrainingRuntimeLibrary.h"

#include "Misc/AutomationTest.h"

IMPLEMENT_SIMPLE_AUTOMATION_TEST(
	FHyperTwistValidationPhaseJCSGuttaeStatePacketContractTest,
	"HyperTwist.Validation.PhaseJCS.GuttaeStatePacketContract",
	EAutomationTestFlags::EditorContext | EAutomationTestFlags::EngineFilter
)

bool FHyperTwistValidationPhaseJCSGuttaeStatePacketContractTest::RunTest(const FString& Parameters)
{
	FHyperTwistTrainingValidationGuttaeStatePacketContract Contract;
	const bool bResolved = UHyperTwistTrainingRuntimeLibrary::TryGetBundledValidationGuttaeStatePacketContract(
		TEXT("validation-guttae-state-packet-contract"),
		Contract);

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

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

	return true;
}

IMPLEMENT_SIMPLE_AUTOMATION_TEST(
	FHyperTwistValidationPhaseJCSOngoingStateRespectBoundaryTest,
	"HyperTwist.Validation.PhaseJCS.OngoingStateRespectBoundary",
	EAutomationTestFlags::EditorContext | EAutomationTestFlags::EngineFilter
)

bool FHyperTwistValidationPhaseJCSOngoingStateRespectBoundaryTest::RunTest(const FString& Parameters)
{
	FHyperTwistTrainingValidationOngoingStateRespectBoundary Boundary;
	const bool bResolved = UHyperTwistTrainingRuntimeLibrary::TryGetBundledValidationOngoingStateRespectBoundary(
		TEXT("validation-ongoing-state-respect-boundary"),
		Boundary);

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

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

	return true;
}
