// Copyright HyperTwist, Inc. All Rights Reserved.

#include "Misc/AutomationTest.h"

#include "HyperTwistTraining/HyperTwistTrainingRuntimeLibrary.h"

#if WITH_AUTOMATION_TESTS

IMPLEMENT_SIMPLE_AUTOMATION_TEST(
	FHyperTwistValidationPhaseJYLayeredStatePacketContractTest,
	"HyperTwist.FirstParty.Validation.PhaseJY.LayeredStatePackets",
	EAutomationTestFlags::EditorContext | EAutomationTestFlags::EngineFilter
)

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

IMPLEMENT_SIMPLE_AUTOMATION_TEST(
	FHyperTwistValidationPhaseJYOngoingStateAlignmentBoundaryTest,
	"HyperTwist.FirstParty.Validation.PhaseJY.OngoingStateAlignments",
	EAutomationTestFlags::EditorContext | EAutomationTestFlags::EngineFilter
)

bool FHyperTwistValidationPhaseJYOngoingStateAlignmentBoundaryTest::RunTest(const FString& Parameters)
{
	FHyperTwistTrainingValidationOngoingStateAlignmentBoundary Boundary;
	TestTrue(
		TEXT("The validation ongoing-state alignment boundary must resolve from the runtime library."),
		UHyperTwistTrainingRuntimeLibrary::TryGetBundledValidationOngoingStateAlignmentBoundary(
			TEXT("validation-ongoing-state-alignment-boundary"),
			Boundary
		)
	);
	TestEqual(
		TEXT("The validation ongoing-state alignment boundary id must stay stable."),
		Boundary.BoundaryId,
		TEXT("validation-ongoing-state-alignment-boundary")
	);
	TestTrue(
		TEXT("The validation ongoing-state alignment boundary must preserve manual-waiver alignments."),
		Boundary.AlignmentIds.Contains(TEXT("ongoing-alignment/manual-waiver-aligned"))
	);
	TestTrue(
		TEXT("The validation ongoing-state alignment boundary must preserve the bounded ongoing-state alignment surface."),
		Boundary.AlignmentSurfaceTags.Contains(TEXT("bounded ongoing-state alignment"))
	);
	TestTrue(
		TEXT("The validation ongoing-state alignment boundary must preserve the no-generic-ongoing-alignment-platform guard."),
		Boundary.AlignmentGuardTags.Contains(TEXT("no-generic-ongoing-alignment-platform guard"))
	);
	TestTrue(
		TEXT("The validation ongoing-state alignment boundary must keep generic ongoing alignment platform ownership excluded."),
		Boundary.ExplicitExclusions.Contains(TEXT("generic ongoing alignment platform ownership"))
	);
	return true;
}

#endif
