#include "HyperTwistTraining/HyperTwistTrainingRuntimeLibrary.h"

#include "Misc/AutomationTest.h"

IMPLEMENT_SIMPLE_AUTOMATION_TEST(
	FHyperTwistValidationPhaseJDMGirdleStatePacketContractTest,
	"HyperTwist.Validation.PhaseJDM.GirdleStatePacketContract",
	EAutomationTestFlags::EditorContext | EAutomationTestFlags::EngineFilter
)

bool FHyperTwistValidationPhaseJDMGirdleStatePacketContractTest::RunTest(const FString& Parameters)
{
	FHyperTwistTrainingValidationGirdleStatePacketContract Contract;
	const bool bResolved = UHyperTwistTrainingRuntimeLibrary::TryGetBundledValidationGirdleStatePacketContract(
		TEXT("validation-girdle-state-packet-contract"),
		Contract);

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

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

	return true;
}

IMPLEMENT_SIMPLE_AUTOMATION_TEST(
	FHyperTwistValidationPhaseJDMOngoingStateRevelryBoundaryTest,
	"HyperTwist.Validation.PhaseJDM.OngoingStateRevelryBoundary",
	EAutomationTestFlags::EditorContext | EAutomationTestFlags::EngineFilter
)

bool FHyperTwistValidationPhaseJDMOngoingStateRevelryBoundaryTest::RunTest(const FString& Parameters)
{
	FHyperTwistTrainingValidationOngoingStateRevelryBoundary Boundary;
	const bool bResolved = UHyperTwistTrainingRuntimeLibrary::TryGetBundledValidationOngoingStateRevelryBoundary(
		TEXT("validation-ongoing-state-revelry-boundary"),
		Boundary);

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

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

	return true;
}
