#include "HyperTwistTraining/HyperTwistTrainingRuntimeLibrary.h"

#include "Misc/AutomationTest.h"

IMPLEMENT_SIMPLE_AUTOMATION_TEST(
	FHyperTwistValidationPhaseJDGCymaStatePacketContractTest,
	"HyperTwist.Validation.PhaseJDG.CymaStatePacketContract",
	EAutomationTestFlags::EditorContext | EAutomationTestFlags::EngineFilter
)

bool FHyperTwistValidationPhaseJDGCymaStatePacketContractTest::RunTest(const FString& Parameters)
{
	FHyperTwistTrainingValidationCymaStatePacketContract Contract;
	const bool bResolved = UHyperTwistTrainingRuntimeLibrary::TryGetBundledValidationCymaStatePacketContract(
		TEXT("validation-cyma-state-packet-contract"),
		Contract);

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

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

	return true;
}

IMPLEMENT_SIMPLE_AUTOMATION_TEST(
	FHyperTwistValidationPhaseJDGOngoingStateDelightBoundaryTest,
	"HyperTwist.Validation.PhaseJDG.OngoingStateDelightBoundary",
	EAutomationTestFlags::EditorContext | EAutomationTestFlags::EngineFilter
)

bool FHyperTwistValidationPhaseJDGOngoingStateDelightBoundaryTest::RunTest(const FString& Parameters)
{
	FHyperTwistTrainingValidationOngoingStateDelightBoundary Boundary;
	const bool bResolved = UHyperTwistTrainingRuntimeLibrary::TryGetBundledValidationOngoingStateDelightBoundary(
		TEXT("validation-ongoing-state-delight-boundary"),
		Boundary);

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

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

	return true;
}
