#include "HyperTwistTraining/HyperTwistTrainingRuntimeLibrary.h"

#include "Misc/AutomationTest.h"

IMPLEMENT_SIMPLE_AUTOMATION_TEST(
	FHyperTwistValidationPhaseJDAFilletStatePacketContractTest,
	"HyperTwist.Validation.PhaseJDA.FilletStatePacketContract",
	EAutomationTestFlags::EditorContext | EAutomationTestFlags::EngineFilter
)

bool FHyperTwistValidationPhaseJDAFilletStatePacketContractTest::RunTest(const FString& Parameters)
{
	FHyperTwistTrainingValidationFilletStatePacketContract Contract;
	const bool bResolved = UHyperTwistTrainingRuntimeLibrary::TryGetBundledValidationFilletStatePacketContract(
		TEXT("validation-fillet-state-packet-contract"),
		Contract);

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

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

	return true;
}

IMPLEMENT_SIMPLE_AUTOMATION_TEST(
	FHyperTwistValidationPhaseJDAOngoingStateGlorificationBoundaryTest,
	"HyperTwist.Validation.PhaseJDA.OngoingStateGlorificationBoundary",
	EAutomationTestFlags::EditorContext | EAutomationTestFlags::EngineFilter
)

bool FHyperTwistValidationPhaseJDAOngoingStateGlorificationBoundaryTest::RunTest(const FString& Parameters)
{
	FHyperTwistTrainingValidationOngoingStateGlorificationBoundary Boundary;
	const bool bResolved = UHyperTwistTrainingRuntimeLibrary::TryGetBundledValidationOngoingStateGlorificationBoundary(
		TEXT("validation-ongoing-state-glorification-boundary"),
		Boundary);

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

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

	return true;
}
