#include "HyperTwistTraining/HyperTwistTrainingRuntimeLibrary.h"

#include "Misc/AutomationTest.h"

IMPLEMENT_SIMPLE_AUTOMATION_TEST(
	FHyperTwistValidationPhaseJCOArchitraveStatePacketContractTest,
	"HyperTwist.Validation.PhaseJCO.ArchitraveStatePacketContract",
	EAutomationTestFlags::EditorContext | EAutomationTestFlags::EngineFilter
)

bool FHyperTwistValidationPhaseJCOArchitraveStatePacketContractTest::RunTest(const FString& Parameters)
{
	FHyperTwistTrainingValidationArchitraveStatePacketContract Contract;
	const bool bResolved = UHyperTwistTrainingRuntimeLibrary::TryGetBundledValidationArchitraveStatePacketContract(
		TEXT("validation-architrave-state-packet-contract"),
		Contract);

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

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

	return true;
}

IMPLEMENT_SIMPLE_AUTOMATION_TEST(
	FHyperTwistValidationPhaseJCOOngoingStateAppreciationBoundaryTest,
	"HyperTwist.Validation.PhaseJCO.OngoingStateAppreciationBoundary",
	EAutomationTestFlags::EditorContext | EAutomationTestFlags::EngineFilter
)

bool FHyperTwistValidationPhaseJCOOngoingStateAppreciationBoundaryTest::RunTest(const FString& Parameters)
{
	FHyperTwistTrainingValidationOngoingStateAppreciationBoundary Boundary;
	const bool bResolved = UHyperTwistTrainingRuntimeLibrary::TryGetBundledValidationOngoingStateAppreciationBoundary(
		TEXT("validation-ongoing-state-appreciation-boundary"),
		Boundary);

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

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

	return true;
}
