#include "HyperTwistTraining/HyperTwistTrainingRuntimeLibrary.h"

#include "Misc/AutomationTest.h"

IMPLEMENT_SIMPLE_AUTOMATION_TEST(
	FHyperTwistValidationPhaseJDCOvoloStatePacketContractTest,
	"HyperTwist.Validation.PhaseJDC.OvoloStatePacketContract",
	EAutomationTestFlags::EditorContext | EAutomationTestFlags::EngineFilter
)

bool FHyperTwistValidationPhaseJDCOvoloStatePacketContractTest::RunTest(const FString& Parameters)
{
	FHyperTwistTrainingValidationOvoloStatePacketContract Contract;
	const bool bResolved = UHyperTwistTrainingRuntimeLibrary::TryGetBundledValidationOvoloStatePacketContract(
		TEXT("validation-ovolo-state-packet-contract"),
		Contract);

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

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

	return true;
}

IMPLEMENT_SIMPLE_AUTOMATION_TEST(
	FHyperTwistValidationPhaseJDCOngoingStateJubilationBoundaryTest,
	"HyperTwist.Validation.PhaseJDC.OngoingStateJubilationBoundary",
	EAutomationTestFlags::EditorContext | EAutomationTestFlags::EngineFilter
)

bool FHyperTwistValidationPhaseJDCOngoingStateJubilationBoundaryTest::RunTest(const FString& Parameters)
{
	FHyperTwistTrainingValidationOngoingStateJubilationBoundary Boundary;
	const bool bResolved = UHyperTwistTrainingRuntimeLibrary::TryGetBundledValidationOngoingStateJubilationBoundary(
		TEXT("validation-ongoing-state-jubilation-boundary"),
		Boundary);

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

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

	return true;
}
