// Copyright HyperTwist, Inc. All Rights Reserved.

#include "Misc/AutomationTest.h"

#include "HyperTwistTraining/HyperTwistTrainingRuntimeLibrary.h"

#if WITH_AUTOMATION_TESTS

IMPLEMENT_SIMPLE_AUTOMATION_TEST(
	FHyperTwistValidationPhaseJBHStrongholdStateLedgerContractTest,
	"HyperTwist.FirstParty.Validation.PhaseJBH.StrongholdStateLedgers",
	EAutomationTestFlags::EditorContext | EAutomationTestFlags::EngineFilter
)

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

IMPLEMENT_SIMPLE_AUTOMATION_TEST(
	FHyperTwistValidationPhaseJBHOngoingStateAnnotationBoundaryTest,
	"HyperTwist.FirstParty.Validation.PhaseJBH.OngoingStateAnnotations",
	EAutomationTestFlags::EditorContext | EAutomationTestFlags::EngineFilter
)

bool FHyperTwistValidationPhaseJBHOngoingStateAnnotationBoundaryTest::RunTest(const FString& Parameters)
{
	FHyperTwistTrainingValidationOngoingStateAnnotationBoundary Boundary;
	TestTrue(
		TEXT("The validation ongoing-state annotation boundary must resolve from the runtime library."),
		UHyperTwistTrainingRuntimeLibrary::TryGetBundledValidationOngoingStateAnnotationBoundary(
			TEXT("validation-ongoing-state-annotation-boundary"),
			Boundary
		)
	);
	TestEqual(
		TEXT("The validation ongoing-state annotation boundary id must stay stable."),
		Boundary.BoundaryId,
		TEXT("validation-ongoing-state-annotation-boundary")
	);
	TestTrue(
		TEXT("The validation ongoing-state annotation boundary must preserve manual-waiver annotations."),
		Boundary.AnnotationIds.Contains(TEXT("ongoing-annotation/manual-waiver-annotation"))
	);
	TestTrue(
		TEXT("The validation ongoing-state annotation boundary must preserve the bounded ongoing-state annotation surface."),
		Boundary.AnnotationSurfaceTags.Contains(TEXT("bounded ongoing-state annotation"))
	);
	TestTrue(
		TEXT("The validation ongoing-state annotation boundary must preserve the no-generic-ongoing-annotation-platform guard."),
		Boundary.AnnotationGuardTags.Contains(TEXT("no-generic-ongoing-annotation-platform guard"))
	);
	TestTrue(
		TEXT("The validation ongoing-state annotation boundary must keep generic ongoing annotation platform ownership excluded."),
		Boundary.ExplicitExclusions.Contains(TEXT("generic ongoing annotation platform ownership"))
	);
	return true;
}

#endif
