// Copyright HyperTwist, Inc. All Rights Reserved.

#include "Misc/AutomationTest.h"

#include "HyperTwistTraining/HyperTwistTrainingRuntimeLibrary.h"

#if WITH_AUTOMATION_TESTS

IMPLEMENT_SIMPLE_AUTOMATION_TEST(
	FHyperTwistValidationPhaseJANHelixedStateLedgerContractTest,
	"HyperTwist.FirstParty.Validation.PhaseJAN.HelixedStateLedgers",
	EAutomationTestFlags::EditorContext | EAutomationTestFlags::EngineFilter
)

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

IMPLEMENT_SIMPLE_AUTOMATION_TEST(
	FHyperTwistValidationPhaseJANOngoingStateEchoBoundaryTest,
	"HyperTwist.FirstParty.Validation.PhaseJAN.OngoingStateEchoes",
	EAutomationTestFlags::EditorContext | EAutomationTestFlags::EngineFilter
)

bool FHyperTwistValidationPhaseJANOngoingStateEchoBoundaryTest::RunTest(const FString& Parameters)
{
	FHyperTwistTrainingValidationOngoingStateEchoBoundary Boundary;
	TestTrue(
		TEXT("The validation ongoing-state echo boundary must resolve from the runtime library."),
		UHyperTwistTrainingRuntimeLibrary::TryGetBundledValidationOngoingStateEchoBoundary(
			TEXT("validation-ongoing-state-echo-boundary"),
			Boundary
		)
	);
	TestEqual(
		TEXT("The validation ongoing-state echo boundary id must stay stable."),
		Boundary.BoundaryId,
		TEXT("validation-ongoing-state-echo-boundary")
	);
	TestTrue(
		TEXT("The validation ongoing-state echo boundary must preserve manual-waiver echoes."),
		Boundary.EchoIds.Contains(TEXT("ongoing-echo/manual-waiver-echoed"))
	);
	TestTrue(
		TEXT("The validation ongoing-state echo boundary must preserve the bounded ongoing-state echo surface."),
		Boundary.EchoSurfaceTags.Contains(TEXT("bounded ongoing-state echo"))
	);
	TestTrue(
		TEXT("The validation ongoing-state echo boundary must preserve the no-generic-ongoing-echo-platform guard."),
		Boundary.EchoGuardTags.Contains(TEXT("no-generic-ongoing-echo-platform guard"))
	);
	TestTrue(
		TEXT("The validation ongoing-state echo boundary must keep generic ongoing echo platform ownership excluded."),
		Boundary.ExplicitExclusions.Contains(TEXT("generic ongoing echo platform ownership"))
	);
	return true;
}

#endif
