// Copyright HyperTwist, Inc. All Rights Reserved.

#include "Misc/AutomationTest.h"

#include "HyperTwistTraining/HyperTwistTrainingRuntimeLibrary.h"

#if WITH_AUTOMATION_TESTS

IMPLEMENT_SIMPLE_AUTOMATION_TEST(
	FHyperTwistValidationPhaseJAPWoundStateLedgerContractTest,
	"HyperTwist.FirstParty.Validation.PhaseJAP.WoundStateLedgers",
	EAutomationTestFlags::EditorContext | EAutomationTestFlags::EngineFilter
)

bool FHyperTwistValidationPhaseJAPWoundStateLedgerContractTest::RunTest(const FString& Parameters)
{
	FHyperTwistTrainingValidationWoundStateLedgerContract Contract;
	TestTrue(
		TEXT("The validation wound-state ledger contract must resolve from the runtime library."),
		UHyperTwistTrainingRuntimeLibrary::TryGetBundledValidationWoundStateLedgerContract(
			TEXT("validation-wound-state-ledger-contract"),
			Contract
		)
	);
	TestEqual(
		TEXT("The validation wound-state ledger contract id must stay stable."),
		Contract.ContractId,
		TEXT("validation-wound-state-ledger-contract")
	);
	TestTrue(
		TEXT("The validation wound-state ledger contract must preserve benchmark-drift wound entries."),
		Contract.LedgerEntryIds.Contains(TEXT("wound-state-ledger/benchmark-drift-wound"))
	);
	TestTrue(
		TEXT("The validation wound-state ledger contract must preserve the bounded wound-state ledger surface."),
		Contract.LedgerSurfaceTags.Contains(TEXT("bounded wound-state ledger"))
	);
	TestTrue(
		TEXT("The validation wound-state ledger contract must preserve the no-generic-wound-state-platform guard."),
		Contract.WoundGuardTags.Contains(TEXT("no-generic-wound-state-platform guard"))
	);
	TestTrue(
		TEXT("The validation wound-state ledger contract must keep generic wound-state platform ownership excluded."),
		Contract.ExplicitExclusions.Contains(TEXT("generic wound-state platform ownership"))
	);
	return true;
}

IMPLEMENT_SIMPLE_AUTOMATION_TEST(
	FHyperTwistValidationPhaseJAPOngoingStateReverberationBoundaryTest,
	"HyperTwist.FirstParty.Validation.PhaseJAP.OngoingStateReverberations",
	EAutomationTestFlags::EditorContext | EAutomationTestFlags::EngineFilter
)

bool FHyperTwistValidationPhaseJAPOngoingStateReverberationBoundaryTest::RunTest(const FString& Parameters)
{
	FHyperTwistTrainingValidationOngoingStateReverberationBoundary Boundary;
	TestTrue(
		TEXT("The validation ongoing-state reverberation boundary must resolve from the runtime library."),
		UHyperTwistTrainingRuntimeLibrary::TryGetBundledValidationOngoingStateReverberationBoundary(
			TEXT("validation-ongoing-state-reverberation-boundary"),
			Boundary
		)
	);
	TestEqual(
		TEXT("The validation ongoing-state reverberation boundary id must stay stable."),
		Boundary.BoundaryId,
		TEXT("validation-ongoing-state-reverberation-boundary")
	);
	TestTrue(
		TEXT("The validation ongoing-state reverberation boundary must preserve manual-waiver reverberations."),
		Boundary.ReverberationIds.Contains(TEXT("ongoing-reverberation/manual-waiver-reverberated"))
	);
	TestTrue(
		TEXT("The validation ongoing-state reverberation boundary must preserve the bounded ongoing-state reverberation surface."),
		Boundary.ReverberationSurfaceTags.Contains(TEXT("bounded ongoing-state reverberation"))
	);
	TestTrue(
		TEXT("The validation ongoing-state reverberation boundary must preserve the no-generic-ongoing-reverberation-platform guard."),
		Boundary.ReverberationGuardTags.Contains(TEXT("no-generic-ongoing-reverberation-platform guard"))
	);
	TestTrue(
		TEXT("The validation ongoing-state reverberation boundary must keep generic ongoing reverberation platform ownership excluded."),
		Boundary.ExplicitExclusions.Contains(TEXT("generic ongoing reverberation platform ownership"))
	);
	return true;
}

#endif
