#include "HyperTwistTraining/HyperTwistTrainingRuntimeLibrary.h"

#include "Misc/AutomationTest.h"

IMPLEMENT_SIMPLE_AUTOMATION_TEST(
	FHyperTwistValidationPhaseJCYSoffitStatePacketContractTest,
	"HyperTwist.Validation.PhaseJCY.SoffitStatePacketContract",
	EAutomationTestFlags::EditorContext | EAutomationTestFlags::EngineFilter
)

bool FHyperTwistValidationPhaseJCYSoffitStatePacketContractTest::RunTest(const FString& Parameters)
{
	FHyperTwistTrainingValidationSoffitStatePacketContract Contract;
	const bool bResolved = UHyperTwistTrainingRuntimeLibrary::TryGetBundledValidationSoffitStatePacketContract(
		TEXT("validation-soffit-state-packet-contract"),
		Contract);

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

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

	return true;
}

IMPLEMENT_SIMPLE_AUTOMATION_TEST(
	FHyperTwistValidationPhaseJCYOngoingStatePraiseBoundaryTest,
	"HyperTwist.Validation.PhaseJCY.OngoingStatePraiseBoundary",
	EAutomationTestFlags::EditorContext | EAutomationTestFlags::EngineFilter
)

bool FHyperTwistValidationPhaseJCYOngoingStatePraiseBoundaryTest::RunTest(const FString& Parameters)
{
	FHyperTwistTrainingValidationOngoingStatePraiseBoundary Boundary;
	const bool bResolved = UHyperTwistTrainingRuntimeLibrary::TryGetBundledValidationOngoingStatePraiseBoundary(
		TEXT("validation-ongoing-state-praise-boundary"),
		Boundary);

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

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

	return true;
}
