// Copyright HyperTwist, Inc. All Rights Reserved.

#include "Misc/AutomationTest.h"

#include "HyperTwistTraining/HyperTwistTrainingRuntimeLibrary.h"

#if WITH_AUTOMATION_TESTS

IMPLEMENT_SIMPLE_AUTOMATION_TEST(
	FHyperTwistValidationPhaseJBDBulwarkedStateLedgerContractTest,
	"HyperTwist.FirstParty.Validation.PhaseJBD.BulwarkedStateLedgers",
	EAutomationTestFlags::EditorContext | EAutomationTestFlags::EngineFilter
)

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

IMPLEMENT_SIMPLE_AUTOMATION_TEST(
	FHyperTwistValidationPhaseJBDOngoingStateInscriptionBoundaryTest,
	"HyperTwist.FirstParty.Validation.PhaseJBD.OngoingStateInscriptions",
	EAutomationTestFlags::EditorContext | EAutomationTestFlags::EngineFilter
)

bool FHyperTwistValidationPhaseJBDOngoingStateInscriptionBoundaryTest::RunTest(const FString& Parameters)
{
	FHyperTwistTrainingValidationOngoingStateInscriptionBoundary Boundary;
	TestTrue(
		TEXT("The validation ongoing-state inscription boundary must resolve from the runtime library."),
		UHyperTwistTrainingRuntimeLibrary::TryGetBundledValidationOngoingStateInscriptionBoundary(
			TEXT("validation-ongoing-state-inscription-boundary"),
			Boundary
		)
	);
	TestEqual(
		TEXT("The validation ongoing-state inscription boundary id must stay stable."),
		Boundary.BoundaryId,
		TEXT("validation-ongoing-state-inscription-boundary")
	);
	TestTrue(
		TEXT("The validation ongoing-state inscription boundary must preserve manual-waiver inscriptions."),
		Boundary.InscriptionIds.Contains(TEXT("ongoing-inscription/manual-waiver-inscription"))
	);
	TestTrue(
		TEXT("The validation ongoing-state inscription boundary must preserve the bounded ongoing-state inscription surface."),
		Boundary.InscriptionSurfaceTags.Contains(TEXT("bounded ongoing-state inscription"))
	);
	TestTrue(
		TEXT("The validation ongoing-state inscription boundary must preserve the no-generic-ongoing-inscription-platform guard."),
		Boundary.InscriptionGuardTags.Contains(TEXT("no-generic-ongoing-inscription-platform guard"))
	);
	TestTrue(
		TEXT("The validation ongoing-state inscription boundary must keep generic ongoing inscription platform ownership excluded."),
		Boundary.ExplicitExclusions.Contains(TEXT("generic ongoing inscription platform ownership"))
	);
	return true;
}

#endif
