#include "HyperTwistTraining/HyperTwistTrainingRuntimeLibrary.h"

#include "Misc/AutomationTest.h"

IMPLEMENT_SIMPLE_AUTOMATION_TEST(
	FHyperTwistValidationPhaseJEGDaisStatePacketContractTest,
	"HyperTwist.Validation.PhaseJEG.DaisStatePacketContract",
	EAutomationTestFlags::EditorContext | EAutomationTestFlags::EngineFilter
)

bool FHyperTwistValidationPhaseJEGDaisStatePacketContractTest::RunTest(const FString& Parameters)
{
	FHyperTwistTrainingValidationDaisStatePacketContract Contract;
	const bool bResolved = UHyperTwistTrainingRuntimeLibrary::TryGetBundledValidationDaisStatePacketContract(
		TEXT("validation-dais-state-packet-contract"),
		Contract);

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

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

	return true;
}

IMPLEMENT_SIMPLE_AUTOMATION_TEST(
	FHyperTwistValidationPhaseJEGOngoingStateLeagueBoundaryTest,
	"HyperTwist.Validation.PhaseJEG.OngoingStateLeagueBoundary",
	EAutomationTestFlags::EditorContext | EAutomationTestFlags::EngineFilter
)

bool FHyperTwistValidationPhaseJEGOngoingStateLeagueBoundaryTest::RunTest(const FString& Parameters)
{
	FHyperTwistTrainingValidationOngoingStateLeagueBoundary Boundary;
	const bool bResolved = UHyperTwistTrainingRuntimeLibrary::TryGetBundledValidationOngoingStateLeagueBoundary(
		TEXT("validation-ongoing-state-league-boundary"),
		Boundary);

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

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

	return true;
}
