// Copyright HyperTwist, Inc. All Rights Reserved.

#include "Misc/AutomationTest.h"

#include "HyperTwistTraining/HyperTwistTrainingRuntimeLibrary.h"

#if WITH_AUTOMATION_TESTS

IMPLEMENT_SIMPLE_AUTOMATION_TEST(
	FHyperTwistValidationPhaseJBBBastionedStateLedgerContractTest,
	"HyperTwist.FirstParty.Validation.PhaseJBB.BastionedStateLedgers",
	EAutomationTestFlags::EditorContext | EAutomationTestFlags::EngineFilter
)

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

IMPLEMENT_SIMPLE_AUTOMATION_TEST(
	FHyperTwistValidationPhaseJBBOngoingStateEngravingBoundaryTest,
	"HyperTwist.FirstParty.Validation.PhaseJBB.OngoingStateEngravings",
	EAutomationTestFlags::EditorContext | EAutomationTestFlags::EngineFilter
)

bool FHyperTwistValidationPhaseJBBOngoingStateEngravingBoundaryTest::RunTest(const FString& Parameters)
{
	FHyperTwistTrainingValidationOngoingStateEngravingBoundary Boundary;
	TestTrue(
		TEXT("The validation ongoing-state engraving boundary must resolve from the runtime library."),
		UHyperTwistTrainingRuntimeLibrary::TryGetBundledValidationOngoingStateEngravingBoundary(
			TEXT("validation-ongoing-state-engraving-boundary"),
			Boundary
		)
	);
	TestEqual(
		TEXT("The validation ongoing-state engraving boundary id must stay stable."),
		Boundary.BoundaryId,
		TEXT("validation-ongoing-state-engraving-boundary")
	);
	TestTrue(
		TEXT("The validation ongoing-state engraving boundary must preserve manual-waiver engravings."),
		Boundary.EngravingIds.Contains(TEXT("ongoing-engraving/manual-waiver-engraving"))
	);
	TestTrue(
		TEXT("The validation ongoing-state engraving boundary must preserve the bounded ongoing-state engraving surface."),
		Boundary.EngravingSurfaceTags.Contains(TEXT("bounded ongoing-state engraving"))
	);
	TestTrue(
		TEXT("The validation ongoing-state engraving boundary must preserve the no-generic-ongoing-engraving-platform guard."),
		Boundary.EngravingGuardTags.Contains(TEXT("no-generic-ongoing-engraving-platform guard"))
	);
	TestTrue(
		TEXT("The validation ongoing-state engraving boundary must keep generic ongoing engraving platform ownership excluded."),
		Boundary.ExplicitExclusions.Contains(TEXT("generic ongoing engraving platform ownership"))
	);
	return true;
}

#endif
