#include "HyperTwistTraining/HyperTwistTrainingRuntimeLibrary.h"

#include "Misc/AutomationTest.h"

IMPLEMENT_SIMPLE_AUTOMATION_TEST(
	FHyperTwistValidationPhaseJDUNeckingStatePacketContractTest,
	"HyperTwist.Validation.PhaseJDU.NeckingStatePacketContract",
	EAutomationTestFlags::EditorContext | EAutomationTestFlags::EngineFilter
)

bool FHyperTwistValidationPhaseJDUNeckingStatePacketContractTest::RunTest(const FString& Parameters)
{
	FHyperTwistTrainingValidationNeckingStatePacketContract Contract;
	const bool bResolved = UHyperTwistTrainingRuntimeLibrary::TryGetBundledValidationNeckingStatePacketContract(
		TEXT("validation-necking-state-packet-contract"),
		Contract);

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

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

	return true;
}

IMPLEMENT_SIMPLE_AUTOMATION_TEST(
	FHyperTwistValidationPhaseJDUOngoingStateSolidarityBoundaryTest,
	"HyperTwist.Validation.PhaseJDU.OngoingStateSolidarityBoundary",
	EAutomationTestFlags::EditorContext | EAutomationTestFlags::EngineFilter
)

bool FHyperTwistValidationPhaseJDUOngoingStateSolidarityBoundaryTest::RunTest(const FString& Parameters)
{
	FHyperTwistTrainingValidationOngoingStateSolidarityBoundary Boundary;
	const bool bResolved = UHyperTwistTrainingRuntimeLibrary::TryGetBundledValidationOngoingStateSolidarityBoundary(
		TEXT("validation-ongoing-state-solidarity-boundary"),
		Boundary);

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

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

	return true;
}
