#include "HyperTwistTraining/HyperTwistTrainingRuntimeLibrary.h"

#include "Misc/AutomationTest.h"

IMPLEMENT_SIMPLE_AUTOMATION_TEST(
	FHyperTwistValidationPhaseJDSEchinusStatePacketContractTest,
	"HyperTwist.Validation.PhaseJDS.EchinusStatePacketContract",
	EAutomationTestFlags::EditorContext | EAutomationTestFlags::EngineFilter
)

bool FHyperTwistValidationPhaseJDSEchinusStatePacketContractTest::RunTest(const FString& Parameters)
{
	FHyperTwistTrainingValidationEchinusStatePacketContract Contract;
	const bool bResolved = UHyperTwistTrainingRuntimeLibrary::TryGetBundledValidationEchinusStatePacketContract(
		TEXT("validation-echinus-state-packet-contract"),
		Contract);

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

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

	return true;
}

IMPLEMENT_SIMPLE_AUTOMATION_TEST(
	FHyperTwistValidationPhaseJDSOngoingStateCompanionshipBoundaryTest,
	"HyperTwist.Validation.PhaseJDS.OngoingStateCompanionshipBoundary",
	EAutomationTestFlags::EditorContext | EAutomationTestFlags::EngineFilter
)

bool FHyperTwistValidationPhaseJDSOngoingStateCompanionshipBoundaryTest::RunTest(const FString& Parameters)
{
	FHyperTwistTrainingValidationOngoingStateCompanionshipBoundary Boundary;
	const bool bResolved = UHyperTwistTrainingRuntimeLibrary::TryGetBundledValidationOngoingStateCompanionshipBoundary(
		TEXT("validation-ongoing-state-companionship-boundary"),
		Boundary);

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

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

	return true;
}
