#include "HyperTwistTraining/HyperTwistTrainingRuntimeLibrary.h"

#include "Misc/AutomationTest.h"

IMPLEMENT_SIMPLE_AUTOMATION_TEST(
	FHyperTwistValidationPhaseJDWGorgerinStatePacketContractTest,
	"HyperTwist.Validation.PhaseJDW.GorgerinStatePacketContract",
	EAutomationTestFlags::EditorContext | EAutomationTestFlags::EngineFilter
)

bool FHyperTwistValidationPhaseJDWGorgerinStatePacketContractTest::RunTest(const FString& Parameters)
{
	FHyperTwistTrainingValidationGorgerinStatePacketContract Contract;
	const bool bResolved = UHyperTwistTrainingRuntimeLibrary::TryGetBundledValidationGorgerinStatePacketContract(
		TEXT("validation-gorgerin-state-packet-contract"),
		Contract);

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

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

	return true;
}

IMPLEMENT_SIMPLE_AUTOMATION_TEST(
	FHyperTwistValidationPhaseJDWOngoingStateAccordBoundaryTest,
	"HyperTwist.Validation.PhaseJDW.OngoingStateAccordBoundary",
	EAutomationTestFlags::EditorContext | EAutomationTestFlags::EngineFilter
)

bool FHyperTwistValidationPhaseJDWOngoingStateAccordBoundaryTest::RunTest(const FString& Parameters)
{
	FHyperTwistTrainingValidationOngoingStateAccordBoundary Boundary;
	const bool bResolved = UHyperTwistTrainingRuntimeLibrary::TryGetBundledValidationOngoingStateAccordBoundary(
		TEXT("validation-ongoing-state-accord-boundary"),
		Boundary);

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

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

	return true;
}
