// Copyright HyperTwist, Inc. All Rights Reserved.

#include "Misc/AutomationTest.h"

#include "HyperTwistTraining/HyperTwistTrainingRuntimeLibrary.h"

#if WITH_AUTOMATION_TESTS

IMPLEMENT_SIMPLE_AUTOMATION_TEST(
	FHyperTwistValidationPhaseJAZTerracedStateLedgerContractTest,
	"HyperTwist.FirstParty.Validation.PhaseJAZ.TerracedStateLedgers",
	EAutomationTestFlags::EditorContext | EAutomationTestFlags::EngineFilter
)

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

IMPLEMENT_SIMPLE_AUTOMATION_TEST(
	FHyperTwistValidationPhaseJAZOngoingStateImpressionBoundaryTest,
	"HyperTwist.FirstParty.Validation.PhaseJAZ.OngoingStateImpressions",
	EAutomationTestFlags::EditorContext | EAutomationTestFlags::EngineFilter
)

bool FHyperTwistValidationPhaseJAZOngoingStateImpressionBoundaryTest::RunTest(const FString& Parameters)
{
	FHyperTwistTrainingValidationOngoingStateImpressionBoundary Boundary;
	TestTrue(
		TEXT("The validation ongoing-state impression boundary must resolve from the runtime library."),
		UHyperTwistTrainingRuntimeLibrary::TryGetBundledValidationOngoingStateImpressionBoundary(
			TEXT("validation-ongoing-state-impression-boundary"),
			Boundary
		)
	);
	TestEqual(
		TEXT("The validation ongoing-state impression boundary id must stay stable."),
		Boundary.BoundaryId,
		TEXT("validation-ongoing-state-impression-boundary")
	);
	TestTrue(
		TEXT("The validation ongoing-state impression boundary must preserve manual-waiver impressions."),
		Boundary.ImpressionIds.Contains(TEXT("ongoing-impression/manual-waiver-impression"))
	);
	TestTrue(
		TEXT("The validation ongoing-state impression boundary must preserve the bounded ongoing-state impression surface."),
		Boundary.ImpressionSurfaceTags.Contains(TEXT("bounded ongoing-state impression"))
	);
	TestTrue(
		TEXT("The validation ongoing-state impression boundary must preserve the no-generic-ongoing-impression-platform guard."),
		Boundary.ImpressionGuardTags.Contains(TEXT("no-generic-ongoing-impression-platform guard"))
	);
	TestTrue(
		TEXT("The validation ongoing-state impression boundary must keep generic ongoing impression platform ownership excluded."),
		Boundary.ExplicitExclusions.Contains(TEXT("generic ongoing impression platform ownership"))
	);
	return true;
}

#endif
