// Copyright HyperTwist, Inc. All Rights Reserved.

#include "Misc/AutomationTest.h"

#include "HyperTwistTraining/HyperTwistTrainingRuntimeLibrary.h"

#if WITH_AUTOMATION_TESTS

IMPLEMENT_SIMPLE_AUTOMATION_TEST(
	FHyperTwistValidationPhaseJOSettledStatePacketContractTest,
	"HyperTwist.FirstParty.Validation.PhaseJO.SettledStatePackets",
	EAutomationTestFlags::EditorContext | EAutomationTestFlags::EngineFilter
)

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

IMPLEMENT_SIMPLE_AUTOMATION_TEST(
	FHyperTwistValidationPhaseJOOngoingStateConfirmationBoundaryTest,
	"HyperTwist.FirstParty.Validation.PhaseJO.OngoingStateConfirmations",
	EAutomationTestFlags::EditorContext | EAutomationTestFlags::EngineFilter
)

bool FHyperTwistValidationPhaseJOOngoingStateConfirmationBoundaryTest::RunTest(const FString& Parameters)
{
	FHyperTwistTrainingValidationOngoingStateConfirmationBoundary Boundary;
	TestTrue(
		TEXT("The validation ongoing-state confirmation boundary must resolve from the runtime library."),
		UHyperTwistTrainingRuntimeLibrary::TryGetBundledValidationOngoingStateConfirmationBoundary(
			TEXT("validation-ongoing-state-confirmation-boundary"),
			Boundary
		)
	);
	TestEqual(
		TEXT("The validation ongoing-state confirmation boundary id must stay stable."),
		Boundary.BoundaryId,
		TEXT("validation-ongoing-state-confirmation-boundary")
	);
	TestTrue(
		TEXT("The validation ongoing-state confirmation boundary must preserve manual-waiver ongoing confirmations."),
		Boundary.ConfirmationIds.Contains(TEXT("ongoing-confirmation/manual-waiver-ongoing"))
	);
	TestTrue(
		TEXT("The validation ongoing-state confirmation boundary must preserve the bounded ongoing-state confirmation surface."),
		Boundary.ConfirmationSurfaceTags.Contains(TEXT("bounded ongoing-state confirmation"))
	);
	TestTrue(
		TEXT("The validation ongoing-state confirmation boundary must preserve the no-generic-ongoing-confirmation-platform guard."),
		Boundary.OngoingGuardTags.Contains(TEXT("no-generic-ongoing-confirmation-platform guard"))
	);
	TestTrue(
		TEXT("The validation ongoing-state confirmation boundary must keep generic ongoing confirmation platform ownership excluded."),
		Boundary.ExplicitExclusions.Contains(TEXT("generic ongoing confirmation platform ownership"))
	);
	return true;
}

#endif
