// Copyright HyperTwist, Inc. All Rights Reserved.

#include "Misc/AutomationTest.h"

#include "HyperTwistTraining/HyperTwistTrainingRuntimeLibrary.h"

#if WITH_AUTOMATION_TESTS

IMPLEMENT_SIMPLE_AUTOMATION_TEST(
	FHyperTwistValidationPhaseJAVRibbedStateLedgerContractTest,
	"HyperTwist.FirstParty.Validation.PhaseJAV.RibbedStateLedgers",
	EAutomationTestFlags::EditorContext | EAutomationTestFlags::EngineFilter
)

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

IMPLEMENT_SIMPLE_AUTOMATION_TEST(
	FHyperTwistValidationPhaseJAVOngoingStateSignatureBoundaryTest,
	"HyperTwist.FirstParty.Validation.PhaseJAV.OngoingStateSignatures",
	EAutomationTestFlags::EditorContext | EAutomationTestFlags::EngineFilter
)

bool FHyperTwistValidationPhaseJAVOngoingStateSignatureBoundaryTest::RunTest(const FString& Parameters)
{
	FHyperTwistTrainingValidationOngoingStateSignatureBoundary Boundary;
	TestTrue(
		TEXT("The validation ongoing-state signature boundary must resolve from the runtime library."),
		UHyperTwistTrainingRuntimeLibrary::TryGetBundledValidationOngoingStateSignatureBoundary(
			TEXT("validation-ongoing-state-signature-boundary"),
			Boundary
		)
	);
	TestEqual(
		TEXT("The validation ongoing-state signature boundary id must stay stable."),
		Boundary.BoundaryId,
		TEXT("validation-ongoing-state-signature-boundary")
	);
	TestTrue(
		TEXT("The validation ongoing-state signature boundary must preserve manual-waiver signatures."),
		Boundary.SignatureIds.Contains(TEXT("ongoing-signature/manual-waiver-signature"))
	);
	TestTrue(
		TEXT("The validation ongoing-state signature boundary must preserve the bounded ongoing-state signature surface."),
		Boundary.SignatureSurfaceTags.Contains(TEXT("bounded ongoing-state signature"))
	);
	TestTrue(
		TEXT("The validation ongoing-state signature boundary must preserve the no-generic-ongoing-signature-platform guard."),
		Boundary.SignatureGuardTags.Contains(TEXT("no-generic-ongoing-signature-platform guard"))
	);
	TestTrue(
		TEXT("The validation ongoing-state signature boundary must keep generic ongoing signature platform ownership excluded."),
		Boundary.ExplicitExclusions.Contains(TEXT("generic ongoing signature platform ownership"))
	);
	return true;
}

#endif
