// Copyright HyperTwist, Inc. All Rights Reserved.

#include "Misc/AutomationTest.h"

#include "HyperTwistTraining/HyperTwistTrainingRuntimeLibrary.h"

#if WITH_AUTOMATION_TESTS

IMPLEMENT_SIMPLE_AUTOMATION_TEST(
	FHyperTwistValidationPhaseJAQFoldedStatePacketContractTest,
	"HyperTwist.FirstParty.Validation.PhaseJAQ.FoldedStatePackets",
	EAutomationTestFlags::EditorContext | EAutomationTestFlags::EngineFilter
)

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

IMPLEMENT_SIMPLE_AUTOMATION_TEST(
	FHyperTwistValidationPhaseJAQOngoingStateAftertoneBoundaryTest,
	"HyperTwist.FirstParty.Validation.PhaseJAQ.OngoingStateAftertones",
	EAutomationTestFlags::EditorContext | EAutomationTestFlags::EngineFilter
)

bool FHyperTwistValidationPhaseJAQOngoingStateAftertoneBoundaryTest::RunTest(const FString& Parameters)
{
	FHyperTwistTrainingValidationOngoingStateAftertoneBoundary Boundary;
	TestTrue(
		TEXT("The validation ongoing-state aftertone boundary must resolve from the runtime library."),
		UHyperTwistTrainingRuntimeLibrary::TryGetBundledValidationOngoingStateAftertoneBoundary(
			TEXT("validation-ongoing-state-aftertone-boundary"),
			Boundary
		)
	);
	TestEqual(
		TEXT("The validation ongoing-state aftertone boundary id must stay stable."),
		Boundary.BoundaryId,
		TEXT("validation-ongoing-state-aftertone-boundary")
	);
	TestTrue(
		TEXT("The validation ongoing-state aftertone boundary must preserve manual-waiver aftertones."),
		Boundary.AftertoneIds.Contains(TEXT("ongoing-aftertone/manual-waiver-aftertoned"))
	);
	TestTrue(
		TEXT("The validation ongoing-state aftertone boundary must preserve the bounded ongoing-state aftertone surface."),
		Boundary.AftertoneSurfaceTags.Contains(TEXT("bounded ongoing-state aftertone"))
	);
	TestTrue(
		TEXT("The validation ongoing-state aftertone boundary must preserve the no-generic-ongoing-aftertone-platform guard."),
		Boundary.AftertoneGuardTags.Contains(TEXT("no-generic-ongoing-aftertone-platform guard"))
	);
	TestTrue(
		TEXT("The validation ongoing-state aftertone boundary must keep generic ongoing aftertone platform ownership excluded."),
		Boundary.ExplicitExclusions.Contains(TEXT("generic ongoing aftertone platform ownership"))
	);
	return true;
}

#endif
