// Copyright HyperTwist, Inc. All Rights Reserved.

#include "Misc/AutomationTest.h"

#include "HyperTwistTraining/HyperTwistTrainingRuntimeLibrary.h"

#if WITH_AUTOMATION_TESTS

IMPLEMENT_SIMPLE_AUTOMATION_TEST(
	FHyperTwistValidationPhaseJIDeferredFollowUpBundleContractTest,
	"HyperTwist.FirstParty.Validation.PhaseJI.DeferredFollowUpBundles",
	EAutomationTestFlags::EditorContext | EAutomationTestFlags::EngineFilter
)

bool FHyperTwistValidationPhaseJIDeferredFollowUpBundleContractTest::RunTest(const FString& Parameters)
{
	FHyperTwistTrainingValidationDeferredFollowUpBundleContract Contract;
	TestTrue(
		TEXT("The validation deferred follow-up bundle contract must resolve from the runtime library."),
		UHyperTwistTrainingRuntimeLibrary::TryGetBundledValidationDeferredFollowUpBundleContract(
			TEXT("validation-deferred-followup-bundle-contract"),
			Contract
		)
	);
	TestEqual(
		TEXT("The validation deferred follow-up bundle contract id must stay stable."),
		Contract.ContractId,
		TEXT("validation-deferred-followup-bundle-contract")
	);
	TestTrue(
		TEXT("The validation deferred follow-up bundle contract must preserve benchmark drift bundles."),
		Contract.FollowUpBundleIds.Contains(TEXT("deferred-followup-bundle/benchmark-drift-bundle"))
	);
	TestTrue(
		TEXT("The validation deferred follow-up bundle contract must preserve the bounded deferred follow-up bundle surface."),
		Contract.BundleSurfaceTags.Contains(TEXT("bounded deferred follow-up bundle"))
	);
	TestTrue(
		TEXT("The validation deferred follow-up bundle contract must preserve the no-task-system-ownership guard."),
		Contract.DeferralGuardTags.Contains(TEXT("no-task-system-ownership guard"))
	);
	TestTrue(
		TEXT("The validation deferred follow-up bundle contract must keep generic task management ownership excluded."),
		Contract.ExplicitExclusions.Contains(TEXT("generic task management ownership"))
	);
	return true;
}

IMPLEMENT_SIMPLE_AUTOMATION_TEST(
	FHyperTwistValidationPhaseJIRevisitCueBoundaryTest,
	"HyperTwist.FirstParty.Validation.PhaseJI.RevisitCues",
	EAutomationTestFlags::EditorContext | EAutomationTestFlags::EngineFilter
)

bool FHyperTwistValidationPhaseJIRevisitCueBoundaryTest::RunTest(const FString& Parameters)
{
	FHyperTwistTrainingValidationRevisitCueBoundary Boundary;
	TestTrue(
		TEXT("The validation revisit-cue boundary must resolve from the runtime library."),
		UHyperTwistTrainingRuntimeLibrary::TryGetBundledValidationRevisitCueBoundary(
			TEXT("validation-revisit-cue-boundary"),
			Boundary
		)
	);
	TestEqual(
		TEXT("The validation revisit-cue boundary id must stay stable."),
		Boundary.BoundaryId,
		TEXT("validation-revisit-cue-boundary")
	);
	TestTrue(
		TEXT("The validation revisit-cue boundary must preserve benchmark baseline revisit cues."),
		Boundary.RevisitCueIds.Contains(TEXT("revisit-cue/benchmark-baseline-revisit"))
	);
	TestTrue(
		TEXT("The validation revisit-cue boundary must preserve the bounded revisit cue surface."),
		Boundary.CueSurfaceTags.Contains(TEXT("bounded revisit cue"))
	);
	TestTrue(
		TEXT("The validation revisit-cue boundary must preserve the no-reminder-platform-ownership guard."),
		Boundary.CueScopeGuardTags.Contains(TEXT("no-reminder-platform-ownership guard"))
	);
	TestTrue(
		TEXT("The validation revisit-cue boundary must keep generic reminder system ownership excluded."),
		Boundary.ExplicitExclusions.Contains(TEXT("generic reminder system ownership"))
	);
	return true;
}

#endif
