// Copyright HyperTwist, Inc. All Rights Reserved.

#include "Misc/AutomationTest.h"

#include "HyperTwistTraining/HyperTwistTrainingRuntimeLibrary.h"

#if WITH_AUTOMATION_TESTS

IMPLEMENT_SIMPLE_AUTOMATION_TEST(
	FHyperTwistValidationPhaseJATCrimpedStateLedgerContractTest,
	"HyperTwist.FirstParty.Validation.PhaseJAT.CrimpedStateLedgers",
	EAutomationTestFlags::EditorContext | EAutomationTestFlags::EngineFilter
)

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

IMPLEMENT_SIMPLE_AUTOMATION_TEST(
	FHyperTwistValidationPhaseJATOngoingStateImprintBoundaryTest,
	"HyperTwist.FirstParty.Validation.PhaseJAT.OngoingStateImprints",
	EAutomationTestFlags::EditorContext | EAutomationTestFlags::EngineFilter
)

bool FHyperTwistValidationPhaseJATOngoingStateImprintBoundaryTest::RunTest(const FString& Parameters)
{
	FHyperTwistTrainingValidationOngoingStateImprintBoundary Boundary;
	TestTrue(
		TEXT("The validation ongoing-state imprint boundary must resolve from the runtime library."),
		UHyperTwistTrainingRuntimeLibrary::TryGetBundledValidationOngoingStateImprintBoundary(
			TEXT("validation-ongoing-state-imprint-boundary"),
			Boundary
		)
	);
	TestEqual(
		TEXT("The validation ongoing-state imprint boundary id must stay stable."),
		Boundary.BoundaryId,
		TEXT("validation-ongoing-state-imprint-boundary")
	);
	TestTrue(
		TEXT("The validation ongoing-state imprint boundary must preserve manual-waiver imprints."),
		Boundary.ImprintIds.Contains(TEXT("ongoing-imprint/manual-waiver-imprint"))
	);
	TestTrue(
		TEXT("The validation ongoing-state imprint boundary must preserve the bounded ongoing-state imprint surface."),
		Boundary.ImprintSurfaceTags.Contains(TEXT("bounded ongoing-state imprint"))
	);
	TestTrue(
		TEXT("The validation ongoing-state imprint boundary must preserve the no-generic-ongoing-imprint-platform guard."),
		Boundary.ImprintGuardTags.Contains(TEXT("no-generic-ongoing-imprint-platform guard"))
	);
	TestTrue(
		TEXT("The validation ongoing-state imprint boundary must keep generic ongoing imprint platform ownership excluded."),
		Boundary.ExplicitExclusions.Contains(TEXT("generic ongoing imprint platform ownership"))
	);
	return true;
}

#endif
