// Copyright HyperTwist, Inc. All Rights Reserved.

#include "Misc/AutomationTest.h"

#include "HyperTwistTraining/HyperTwistTrainingRuntimeLibrary.h"

#if WITH_AUTOMATION_TESTS

IMPLEMENT_SIMPLE_AUTOMATION_TEST(
	FHyperTwistValidationPhaseJBFCitadelStateLedgerContractTest,
	"HyperTwist.FirstParty.Validation.PhaseJBF.CitadelStateLedgers",
	EAutomationTestFlags::EditorContext | EAutomationTestFlags::EngineFilter
)

bool FHyperTwistValidationPhaseJBFCitadelStateLedgerContractTest::RunTest(const FString& Parameters)
{
	FHyperTwistTrainingValidationCitadelStateLedgerContract Contract;
	TestTrue(
		TEXT("The validation citadel-state ledger contract must resolve from the runtime library."),
		UHyperTwistTrainingRuntimeLibrary::TryGetBundledValidationCitadelStateLedgerContract(
			TEXT("validation-citadel-state-ledger-contract"),
			Contract
		)
	);
	TestEqual(
		TEXT("The validation citadel-state ledger contract id must stay stable."),
		Contract.ContractId,
		TEXT("validation-citadel-state-ledger-contract")
	);
	TestTrue(
		TEXT("The validation citadel-state ledger contract must preserve benchmark-drift citadel ledgers."),
		Contract.LedgerIds.Contains(TEXT("citadel-state-ledger/benchmark-drift-citadel"))
	);
	TestTrue(
		TEXT("The validation citadel-state ledger contract must preserve the bounded citadel-state ledger surface."),
		Contract.LedgerSurfaceTags.Contains(TEXT("bounded citadel-state ledger"))
	);
	TestTrue(
		TEXT("The validation citadel-state ledger contract must preserve the no-generic-citadel-state-platform guard."),
		Contract.CitadelGuardTags.Contains(TEXT("no-generic-citadel-state-platform guard"))
	);
	TestTrue(
		TEXT("The validation citadel-state ledger contract must keep generic citadel-state platform ownership excluded."),
		Contract.ExplicitExclusions.Contains(TEXT("generic citadel-state platform ownership"))
	);
	return true;
}

IMPLEMENT_SIMPLE_AUTOMATION_TEST(
	FHyperTwistValidationPhaseJBFOngoingStateTracingBoundaryTest,
	"HyperTwist.FirstParty.Validation.PhaseJBF.OngoingStateTracings",
	EAutomationTestFlags::EditorContext | EAutomationTestFlags::EngineFilter
)

bool FHyperTwistValidationPhaseJBFOngoingStateTracingBoundaryTest::RunTest(const FString& Parameters)
{
	FHyperTwistTrainingValidationOngoingStateTracingBoundary Boundary;
	TestTrue(
		TEXT("The validation ongoing-state tracing boundary must resolve from the runtime library."),
		UHyperTwistTrainingRuntimeLibrary::TryGetBundledValidationOngoingStateTracingBoundary(
			TEXT("validation-ongoing-state-tracing-boundary"),
			Boundary
		)
	);
	TestEqual(
		TEXT("The validation ongoing-state tracing boundary id must stay stable."),
		Boundary.BoundaryId,
		TEXT("validation-ongoing-state-tracing-boundary")
	);
	TestTrue(
		TEXT("The validation ongoing-state tracing boundary must preserve manual-waiver tracings."),
		Boundary.TracingIds.Contains(TEXT("ongoing-tracing/manual-waiver-tracing"))
	);
	TestTrue(
		TEXT("The validation ongoing-state tracing boundary must preserve the bounded ongoing-state tracing surface."),
		Boundary.TracingSurfaceTags.Contains(TEXT("bounded ongoing-state tracing"))
	);
	TestTrue(
		TEXT("The validation ongoing-state tracing boundary must preserve the no-generic-ongoing-tracing-platform guard."),
		Boundary.TracingGuardTags.Contains(TEXT("no-generic-ongoing-tracing-platform guard"))
	);
	TestTrue(
		TEXT("The validation ongoing-state tracing boundary must keep generic ongoing tracing platform ownership excluded."),
		Boundary.ExplicitExclusions.Contains(TEXT("generic ongoing tracing platform ownership"))
	);
	return true;
}

#endif
