// Copyright HyperTwist, Inc. All Rights Reserved.

#include "Misc/AutomationTest.h"

#include "HyperTwistTraining/HyperTwistTrainingRuntimeLibrary.h"

#if WITH_AUTOMATION_TESTS

IMPLEMENT_SIMPLE_AUTOMATION_TEST(
	FHyperTwistValidationPhaseJKDormantStateLedgerContractTest,
	"HyperTwist.FirstParty.Validation.PhaseJK.DormantLedgers",
	EAutomationTestFlags::EditorContext | EAutomationTestFlags::EngineFilter
)

bool FHyperTwistValidationPhaseJKDormantStateLedgerContractTest::RunTest(const FString& Parameters)
{
	FHyperTwistTrainingValidationDormantStateLedgerContract Contract;
	TestTrue(
		TEXT("The validation dormant-state ledger contract must resolve from the runtime library."),
		UHyperTwistTrainingRuntimeLibrary::TryGetBundledValidationDormantStateLedgerContract(
			TEXT("validation-dormant-state-ledger-contract"),
			Contract
		)
	);
	TestEqual(
		TEXT("The validation dormant-state ledger contract id must stay stable."),
		Contract.ContractId,
		TEXT("validation-dormant-state-ledger-contract")
	);
	TestTrue(
		TEXT("The validation dormant-state ledger contract must preserve benchmark-drift dormant ledger entries."),
		Contract.LedgerEntryIds.Contains(TEXT("dormant-ledger/benchmark-drift-on-hold"))
	);
	TestTrue(
		TEXT("The validation dormant-state ledger contract must preserve the bounded dormant-state ledger surface."),
		Contract.LedgerSurfaceTags.Contains(TEXT("bounded dormant-state ledger"))
	);
	TestTrue(
		TEXT("The validation dormant-state ledger contract must preserve the no-snooze-system-ownership guard."),
		Contract.DormancyGuardTags.Contains(TEXT("no-snooze-system-ownership guard"))
	);
	TestTrue(
		TEXT("The validation dormant-state ledger contract must keep generic snooze state ownership excluded."),
		Contract.ExplicitExclusions.Contains(TEXT("generic snooze state ownership"))
	);
	return true;
}

IMPLEMENT_SIMPLE_AUTOMATION_TEST(
	FHyperTwistValidationPhaseJKResurfacingCueBoundaryTest,
	"HyperTwist.FirstParty.Validation.PhaseJK.ResurfacingCues",
	EAutomationTestFlags::EditorContext | EAutomationTestFlags::EngineFilter
)

bool FHyperTwistValidationPhaseJKResurfacingCueBoundaryTest::RunTest(const FString& Parameters)
{
	FHyperTwistTrainingValidationResurfacingCueBoundary Boundary;
	TestTrue(
		TEXT("The validation resurfacing-cue boundary must resolve from the runtime library."),
		UHyperTwistTrainingRuntimeLibrary::TryGetBundledValidationResurfacingCueBoundary(
			TEXT("validation-resurfacing-cue-boundary"),
			Boundary
		)
	);
	TestEqual(
		TEXT("The validation resurfacing-cue boundary id must stay stable."),
		Boundary.BoundaryId,
		TEXT("validation-resurfacing-cue-boundary")
	);
	TestTrue(
		TEXT("The validation resurfacing-cue boundary must preserve manual-waiver return cues."),
		Boundary.ResurfacingCueIds.Contains(TEXT("resurfacing-cue/manual-waiver-return"))
	);
	TestTrue(
		TEXT("The validation resurfacing-cue boundary must preserve the bounded resurfacing cue surface."),
		Boundary.CueSurfaceTags.Contains(TEXT("bounded resurfacing cue"))
	);
	TestTrue(
		TEXT("The validation resurfacing-cue boundary must preserve the no-reminder-reactivation-platform guard."),
		Boundary.ResurfacingGuardTags.Contains(TEXT("no-reminder-reactivation-platform guard"))
	);
	TestTrue(
		TEXT("The validation resurfacing-cue boundary must keep generic reactivation reminder ownership excluded."),
		Boundary.ExplicitExclusions.Contains(TEXT("generic reactivation reminder ownership"))
	);
	return true;
}

#endif
