#include "HyperTwistTraining/HyperTwistTrainingRuntimeLibrary.h"

#include "Misc/AutomationTest.h"

IMPLEMENT_SIMPLE_AUTOMATION_TEST(
	FHyperTwistValidationPhaseJFMSacrariumStatePacketContractTest,
	"HyperTwist.Validation.PhaseJFM.SacrariumStatePacketContract",
	EAutomationTestFlags::EditorContext | EAutomationTestFlags::EngineFilter
)

bool FHyperTwistValidationPhaseJFMSacrariumStatePacketContractTest::RunTest(const FString& Parameters)
{
	FHyperTwistTrainingValidationSacrariumStatePacketContract Contract;
	const bool bResolved = UHyperTwistTrainingRuntimeLibrary::TryGetBundledValidationSacrariumStatePacketContract(
		TEXT("validation-sacrarium-state-packet-contract"),
		Contract);

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

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

	return true;
}

IMPLEMENT_SIMPLE_AUTOMATION_TEST(
	FHyperTwistValidationPhaseJFMOngoingStateConopeumBoundaryTest,
	"HyperTwist.Validation.PhaseJFM.OngoingStateConopeumBoundary",
	EAutomationTestFlags::EditorContext | EAutomationTestFlags::EngineFilter
)

bool FHyperTwistValidationPhaseJFMOngoingStateConopeumBoundaryTest::RunTest(const FString& Parameters)
{
	FHyperTwistTrainingValidationOngoingStateConopeumBoundary Boundary;
	const bool bResolved = UHyperTwistTrainingRuntimeLibrary::TryGetBundledValidationOngoingStateConopeumBoundary(
		TEXT("validation-ongoing-state-conopeum-boundary"),
		Boundary);

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

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

	return true;
}
