// Copyright HyperTwist, Inc. All Rights Reserved.

#include "Misc/AutomationTest.h"

#include "HyperTwistTraining/HyperTwistTrainingRuntimeLibrary.h"

#if WITH_AUTOMATION_TESTS

IMPLEMENT_SIMPLE_AUTOMATION_TEST(
	FHyperTwistValidationPhaseJBAButtressedStatePacketContractTest,
	"HyperTwist.FirstParty.Validation.PhaseJBA.ButtressedStatePackets",
	EAutomationTestFlags::EditorContext | EAutomationTestFlags::EngineFilter
)

bool FHyperTwistValidationPhaseJBAButtressedStatePacketContractTest::RunTest(const FString& Parameters)
{
	FHyperTwistTrainingValidationButtressedStatePacketContract Contract;
	TestTrue(
		TEXT("The validation buttressed-state packet contract must resolve from the runtime library."),
		UHyperTwistTrainingRuntimeLibrary::TryGetBundledValidationButtressedStatePacketContract(
			TEXT("validation-buttressed-state-packet-contract"),
			Contract
		)
	);
	TestEqual(
		TEXT("The validation buttressed-state packet contract id must stay stable."),
		Contract.ContractId,
		TEXT("validation-buttressed-state-packet-contract")
	);
	TestTrue(
		TEXT("The validation buttressed-state packet contract must preserve benchmark-drift buttressed packets."),
		Contract.PacketIds.Contains(TEXT("buttressed-state-packet/benchmark-drift-buttressed"))
	);
	TestTrue(
		TEXT("The validation buttressed-state packet contract must preserve the bounded buttressed-state packet surface."),
		Contract.PacketSurfaceTags.Contains(TEXT("bounded buttressed-state packet"))
	);
	TestTrue(
		TEXT("The validation buttressed-state packet contract must preserve the no-generic-buttressed-state-platform guard."),
		Contract.ButtressedGuardTags.Contains(TEXT("no-generic-buttressed-state-platform guard"))
	);
	TestTrue(
		TEXT("The validation buttressed-state packet contract must keep generic buttressed-state platform ownership excluded."),
		Contract.ExplicitExclusions.Contains(TEXT("generic buttressed-state platform ownership"))
	);
	return true;
}

IMPLEMENT_SIMPLE_AUTOMATION_TEST(
	FHyperTwistValidationPhaseJBAOngoingStateEtchingBoundaryTest,
	"HyperTwist.FirstParty.Validation.PhaseJBA.OngoingStateEtchings",
	EAutomationTestFlags::EditorContext | EAutomationTestFlags::EngineFilter
)

bool FHyperTwistValidationPhaseJBAOngoingStateEtchingBoundaryTest::RunTest(const FString& Parameters)
{
	FHyperTwistTrainingValidationOngoingStateEtchingBoundary Boundary;
	TestTrue(
		TEXT("The validation ongoing-state etching boundary must resolve from the runtime library."),
		UHyperTwistTrainingRuntimeLibrary::TryGetBundledValidationOngoingStateEtchingBoundary(
			TEXT("validation-ongoing-state-etching-boundary"),
			Boundary
		)
	);
	TestEqual(
		TEXT("The validation ongoing-state etching boundary id must stay stable."),
		Boundary.BoundaryId,
		TEXT("validation-ongoing-state-etching-boundary")
	);
	TestTrue(
		TEXT("The validation ongoing-state etching boundary must preserve manual-waiver etchings."),
		Boundary.EtchingIds.Contains(TEXT("ongoing-etching/manual-waiver-etching"))
	);
	TestTrue(
		TEXT("The validation ongoing-state etching boundary must preserve the bounded ongoing-state etching surface."),
		Boundary.EtchingSurfaceTags.Contains(TEXT("bounded ongoing-state etching"))
	);
	TestTrue(
		TEXT("The validation ongoing-state etching boundary must preserve the no-generic-ongoing-etching-platform guard."),
		Boundary.EtchingGuardTags.Contains(TEXT("no-generic-ongoing-etching-platform guard"))
	);
	TestTrue(
		TEXT("The validation ongoing-state etching boundary must keep generic ongoing etching platform ownership excluded."),
		Boundary.ExplicitExclusions.Contains(TEXT("generic ongoing etching platform ownership"))
	);
	return true;
}

#endif
