#include "HyperTwistTraining/HyperTwistTrainingRuntimeLibrary.h"

#include "Misc/AutomationTest.h"

IMPLEMENT_SIMPLE_AUTOMATION_TEST(
	FHyperTwistValidationPhaseJEYCiboriumStatePacketContractTest,
	"HyperTwist.Validation.PhaseJEY.CiboriumStatePacketContract",
	EAutomationTestFlags::EditorContext | EAutomationTestFlags::EngineFilter
)

bool FHyperTwistValidationPhaseJEYCiboriumStatePacketContractTest::RunTest(const FString& Parameters)
{
	FHyperTwistTrainingValidationCiboriumStatePacketContract Contract;
	const bool bResolved = UHyperTwistTrainingRuntimeLibrary::TryGetBundledValidationCiboriumStatePacketContract(
		TEXT("validation-ciborium-state-packet-contract"),
		Contract);

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

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

	return true;
}

IMPLEMENT_SIMPLE_AUTOMATION_TEST(
	FHyperTwistValidationPhaseJEYOngoingStateBaldachinBoundaryTest,
	"HyperTwist.Validation.PhaseJEY.OngoingStateBaldachinBoundary",
	EAutomationTestFlags::EditorContext | EAutomationTestFlags::EngineFilter
)

bool FHyperTwistValidationPhaseJEYOngoingStateBaldachinBoundaryTest::RunTest(const FString& Parameters)
{
	FHyperTwistTrainingValidationOngoingStateBaldachinBoundary Boundary;
	const bool bResolved = UHyperTwistTrainingRuntimeLibrary::TryGetBundledValidationOngoingStateBaldachinBoundary(
		TEXT("validation-ongoing-state-baldachin-boundary"),
		Boundary);

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

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

	return true;
}
