// Copyright HyperTwist, Inc. All Rights Reserved.

#include "Misc/AutomationTest.h"

#include "HyperTwistTraining/HyperTwistTrainingRuntimeLibrary.h"

#if WITH_AUTOMATION_TESTS

IMPLEMENT_SIMPLE_AUTOMATION_TEST(
	FHyperTwistValidationPhaseJBKParapetStatePacketContractTest,
	"HyperTwist.FirstParty.Validation.PhaseJBK.ParapetStatePackets",
	EAutomationTestFlags::EditorContext | EAutomationTestFlags::EngineFilter
)

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

IMPLEMENT_SIMPLE_AUTOMATION_TEST(
	FHyperTwistValidationPhaseJBKOngoingStateLegendBoundaryTest,
	"HyperTwist.FirstParty.Validation.PhaseJBK.OngoingStateLegends",
	EAutomationTestFlags::EditorContext | EAutomationTestFlags::EngineFilter
)

bool FHyperTwistValidationPhaseJBKOngoingStateLegendBoundaryTest::RunTest(const FString& Parameters)
{
	FHyperTwistTrainingValidationOngoingStateLegendBoundary Boundary;
	TestTrue(
		TEXT("The validation ongoing-state legend boundary must resolve from the runtime library."),
		UHyperTwistTrainingRuntimeLibrary::TryGetBundledValidationOngoingStateLegendBoundary(
			TEXT("validation-ongoing-state-legend-boundary"),
			Boundary
		)
	);
	TestEqual(
		TEXT("The validation ongoing-state legend boundary id must stay stable."),
		Boundary.BoundaryId,
		TEXT("validation-ongoing-state-legend-boundary")
	);
	TestTrue(
		TEXT("The validation ongoing-state legend boundary must preserve manual-waiver legends."),
		Boundary.LegendIds.Contains(TEXT("ongoing-legend/manual-waiver-legend"))
	);
	TestTrue(
		TEXT("The validation ongoing-state legend boundary must preserve the bounded ongoing-state legend surface."),
		Boundary.LegendSurfaceTags.Contains(TEXT("bounded ongoing-state legend"))
	);
	TestTrue(
		TEXT("The validation ongoing-state legend boundary must preserve the no-generic-ongoing-legend-platform guard."),
		Boundary.LegendGuardTags.Contains(TEXT("no-generic-ongoing-legend-platform guard"))
	);
	TestTrue(
		TEXT("The validation ongoing-state legend boundary must keep generic ongoing legend platform ownership excluded."),
		Boundary.ExplicitExclusions.Contains(TEXT("generic ongoing legend platform ownership"))
	);
	return true;
}

#endif
