// Copyright HyperTwist, Inc. All Rights Reserved.

#include "Misc/AutomationTest.h"

#include "HyperTwistTraining/HyperTwistTrainingRuntimeLibrary.h"

#if WITH_AUTOMATION_TESTS

IMPLEMENT_SIMPLE_AUTOMATION_TEST(
	FHyperTwistValidationPhaseJAFBlendedStateLedgerContractTest,
	"HyperTwist.FirstParty.Validation.PhaseJAF.BlendedStateLedgers",
	EAutomationTestFlags::EditorContext | EAutomationTestFlags::EngineFilter
)

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

IMPLEMENT_SIMPLE_AUTOMATION_TEST(
	FHyperTwistValidationPhaseJAFOngoingStateCorrespondenceBoundaryTest,
	"HyperTwist.FirstParty.Validation.PhaseJAF.OngoingStateCorrespondences",
	EAutomationTestFlags::EditorContext | EAutomationTestFlags::EngineFilter
)

bool FHyperTwistValidationPhaseJAFOngoingStateCorrespondenceBoundaryTest::RunTest(const FString& Parameters)
{
	FHyperTwistTrainingValidationOngoingStateCorrespondenceBoundary Boundary;
	TestTrue(
		TEXT("The validation ongoing-state correspondence boundary must resolve from the runtime library."),
		UHyperTwistTrainingRuntimeLibrary::TryGetBundledValidationOngoingStateCorrespondenceBoundary(
			TEXT("validation-ongoing-state-correspondence-boundary"),
			Boundary
		)
	);
	TestEqual(
		TEXT("The validation ongoing-state correspondence boundary id must stay stable."),
		Boundary.BoundaryId,
		TEXT("validation-ongoing-state-correspondence-boundary")
	);
	TestTrue(
		TEXT("The validation ongoing-state correspondence boundary must preserve manual-waiver correspondences."),
		Boundary.CorrespondenceIds.Contains(TEXT("ongoing-correspondence/manual-waiver-correspondent"))
	);
	TestTrue(
		TEXT("The validation ongoing-state correspondence boundary must preserve the bounded ongoing-state correspondence surface."),
		Boundary.CorrespondenceSurfaceTags.Contains(TEXT("bounded ongoing-state correspondence"))
	);
	TestTrue(
		TEXT("The validation ongoing-state correspondence boundary must preserve the no-generic-ongoing-correspondence-platform guard."),
		Boundary.CorrespondenceGuardTags.Contains(TEXT("no-generic-ongoing-correspondence-platform guard"))
	);
	TestTrue(
		TEXT("The validation ongoing-state correspondence boundary must keep generic ongoing correspondence platform ownership excluded."),
		Boundary.ExplicitExclusions.Contains(TEXT("generic ongoing correspondence platform ownership"))
	);
	return true;
}

#endif
