#include "HyperTwistTraining/HyperTwistTrainingRuntimeLibrary.h"

#include "Misc/AutomationTest.h"

IMPLEMENT_SIMPLE_AUTOMATION_TEST(
	FHyperTwistValidationPhaseJEUAisleStatePacketContractTest,
	"HyperTwist.Validation.PhaseJEU.AisleStatePacketContract",
	EAutomationTestFlags::EditorContext | EAutomationTestFlags::EngineFilter
)

bool FHyperTwistValidationPhaseJEUAisleStatePacketContractTest::RunTest(const FString& Parameters)
{
	FHyperTwistTrainingValidationAisleStatePacketContract Contract;
	const bool bResolved = UHyperTwistTrainingRuntimeLibrary::TryGetBundledValidationAisleStatePacketContract(
		TEXT("validation-aisle-state-packet-contract"),
		Contract);

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

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

	return true;
}

IMPLEMENT_SIMPLE_AUTOMATION_TEST(
	FHyperTwistValidationPhaseJEUOngoingStateChancelBoundaryTest,
	"HyperTwist.Validation.PhaseJEU.OngoingStateChancelBoundary",
	EAutomationTestFlags::EditorContext | EAutomationTestFlags::EngineFilter
)

bool FHyperTwistValidationPhaseJEUOngoingStateChancelBoundaryTest::RunTest(const FString& Parameters)
{
	FHyperTwistTrainingValidationOngoingStateChancelBoundary Boundary;
	const bool bResolved = UHyperTwistTrainingRuntimeLibrary::TryGetBundledValidationOngoingStateChancelBoundary(
		TEXT("validation-ongoing-state-chancel-boundary"),
		Boundary);

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

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

	return true;
}
