// Copyright HyperTwist, Inc. All Rights Reserved.

#include "Misc/AutomationTest.h"

#include "HyperTwistTraining/HyperTwistTrainingRuntimeLibrary.h"

#if WITH_AUTOMATION_TESTS

IMPLEMENT_SIMPLE_AUTOMATION_TEST(
	FHyperTwistValidationPhaseJAACompositeStatePacketContractTest,
	"HyperTwist.FirstParty.Validation.PhaseJAA.CompositeStatePackets",
	EAutomationTestFlags::EditorContext | EAutomationTestFlags::EngineFilter
)

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

IMPLEMENT_SIMPLE_AUTOMATION_TEST(
	FHyperTwistValidationPhaseJAAOngoingStateSynthesisBoundaryTest,
	"HyperTwist.FirstParty.Validation.PhaseJAA.OngoingStateSyntheses",
	EAutomationTestFlags::EditorContext | EAutomationTestFlags::EngineFilter
)

bool FHyperTwistValidationPhaseJAAOngoingStateSynthesisBoundaryTest::RunTest(const FString& Parameters)
{
	FHyperTwistTrainingValidationOngoingStateSynthesisBoundary Boundary;
	TestTrue(
		TEXT("The validation ongoing-state synthesis boundary must resolve from the runtime library."),
		UHyperTwistTrainingRuntimeLibrary::TryGetBundledValidationOngoingStateSynthesisBoundary(
			TEXT("validation-ongoing-state-synthesis-boundary"),
			Boundary
		)
	);
	TestEqual(
		TEXT("The validation ongoing-state synthesis boundary id must stay stable."),
		Boundary.BoundaryId,
		TEXT("validation-ongoing-state-synthesis-boundary")
	);
	TestTrue(
		TEXT("The validation ongoing-state synthesis boundary must preserve manual-waiver syntheses."),
		Boundary.SynthesisIds.Contains(TEXT("ongoing-synthesis/manual-waiver-synthesized"))
	);
	TestTrue(
		TEXT("The validation ongoing-state synthesis boundary must preserve the bounded ongoing-state synthesis surface."),
		Boundary.SynthesisSurfaceTags.Contains(TEXT("bounded ongoing-state synthesis"))
	);
	TestTrue(
		TEXT("The validation ongoing-state synthesis boundary must preserve the no-generic-ongoing-synthesis-platform guard."),
		Boundary.SynthesisGuardTags.Contains(TEXT("no-generic-ongoing-synthesis-platform guard"))
	);
	TestTrue(
		TEXT("The validation ongoing-state synthesis boundary must keep generic ongoing synthesis platform ownership excluded."),
		Boundary.ExplicitExclusions.Contains(TEXT("generic ongoing synthesis platform ownership"))
	);
	return true;
}

#endif
