// Copyright HyperTwist, Inc. All Rights Reserved.

#include "Misc/AutomationTest.h"

#include "HyperTwistTraining/HyperTwistTrainingRuntimeLibrary.h"

#if WITH_AUTOMATION_TESTS

IMPLEMENT_SIMPLE_AUTOMATION_TEST(
	FHyperTwistValidationPhaseJBIWatchtowerStatePacketContractTest,
	"HyperTwist.FirstParty.Validation.PhaseJBI.WatchtowerStatePackets",
	EAutomationTestFlags::EditorContext | EAutomationTestFlags::EngineFilter
)

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

IMPLEMENT_SIMPLE_AUTOMATION_TEST(
	FHyperTwistValidationPhaseJBIOngoingStateGlossBoundaryTest,
	"HyperTwist.FirstParty.Validation.PhaseJBI.OngoingStateGlosses",
	EAutomationTestFlags::EditorContext | EAutomationTestFlags::EngineFilter
)

bool FHyperTwistValidationPhaseJBIOngoingStateGlossBoundaryTest::RunTest(const FString& Parameters)
{
	FHyperTwistTrainingValidationOngoingStateGlossBoundary Boundary;
	TestTrue(
		TEXT("The validation ongoing-state gloss boundary must resolve from the runtime library."),
		UHyperTwistTrainingRuntimeLibrary::TryGetBundledValidationOngoingStateGlossBoundary(
			TEXT("validation-ongoing-state-gloss-boundary"),
			Boundary
		)
	);
	TestEqual(
		TEXT("The validation ongoing-state gloss boundary id must stay stable."),
		Boundary.BoundaryId,
		TEXT("validation-ongoing-state-gloss-boundary")
	);
	TestTrue(
		TEXT("The validation ongoing-state gloss boundary must preserve manual-waiver glosses."),
		Boundary.GlossIds.Contains(TEXT("ongoing-gloss/manual-waiver-gloss"))
	);
	TestTrue(
		TEXT("The validation ongoing-state gloss boundary must preserve the bounded ongoing-state gloss surface."),
		Boundary.GlossSurfaceTags.Contains(TEXT("bounded ongoing-state gloss"))
	);
	TestTrue(
		TEXT("The validation ongoing-state gloss boundary must preserve the no-generic-ongoing-gloss-platform guard."),
		Boundary.GlossGuardTags.Contains(TEXT("no-generic-ongoing-gloss-platform guard"))
	);
	TestTrue(
		TEXT("The validation ongoing-state gloss boundary must keep generic ongoing gloss platform ownership excluded."),
		Boundary.ExplicitExclusions.Contains(TEXT("generic ongoing gloss platform ownership"))
	);
	return true;
}

#endif
