// Copyright HyperTwist, Inc. All Rights Reserved.

#include "Misc/AutomationTest.h"

#include "HyperTwistTraining/HyperTwistTrainingRuntimeLibrary.h"

#if WITH_AUTOMATION_TESTS

IMPLEMENT_SIMPLE_AUTOMATION_TEST(
	FHyperTwistValidationPhaseJFExceptionWaiverContractTest,
	"HyperTwist.FirstParty.Validation.PhaseJF.ExceptionWaivers",
	EAutomationTestFlags::EditorContext | EAutomationTestFlags::EngineFilter
)

bool FHyperTwistValidationPhaseJFExceptionWaiverContractTest::RunTest(const FString& Parameters)
{
	FHyperTwistTrainingValidationExceptionWaiverContract Contract;
	TestTrue(
		TEXT("The validation exception-waiver contract must resolve from the runtime library."),
		UHyperTwistTrainingRuntimeLibrary::TryGetBundledValidationExceptionWaiverContract(
			TEXT("validation-exception-waiver-contract"),
			Contract
		)
	);
	TestEqual(
		TEXT("The validation exception-waiver contract id must stay stable."),
		Contract.ContractId,
		TEXT("validation-exception-waiver-contract")
	);
	TestTrue(
		TEXT("The validation exception-waiver contract must preserve the benchmark-baseline-drift waiver kind."),
		Contract.WaiverKindIds.Contains(TEXT("exception-waiver/benchmark-baseline-drift"))
	);
	TestTrue(
		TEXT("The validation exception-waiver contract must preserve the bounded validation exception waiver surface."),
		Contract.WaiverSurfaceTags.Contains(TEXT("bounded validation exception waiver"))
	);
	TestTrue(
		TEXT("The validation exception-waiver contract must preserve the no-release-certification guard."),
		Contract.ReviewGuardTags.Contains(TEXT("no-release-certification guard"))
	);
	TestTrue(
		TEXT("The validation exception-waiver contract must keep generic policy exception ownership excluded."),
		Contract.ExplicitExclusions.Contains(TEXT("generic policy exception ownership"))
	);
	return true;
}

IMPLEMENT_SIMPLE_AUTOMATION_TEST(
	FHyperTwistValidationPhaseJFHandoffClosureBoundaryTest,
	"HyperTwist.FirstParty.Validation.PhaseJF.HandoffClosures",
	EAutomationTestFlags::EditorContext | EAutomationTestFlags::EngineFilter
)

bool FHyperTwistValidationPhaseJFHandoffClosureBoundaryTest::RunTest(const FString& Parameters)
{
	FHyperTwistTrainingValidationHandoffClosureBoundary Boundary;
	TestTrue(
		TEXT("The validation handoff-closure boundary must resolve from the runtime library."),
		UHyperTwistTrainingRuntimeLibrary::TryGetBundledValidationHandoffClosureBoundary(
			TEXT("validation-handoff-closure-boundary"),
			Boundary
		)
	);
	TestEqual(
		TEXT("The validation handoff-closure boundary id must stay stable."),
		Boundary.BoundaryId,
		TEXT("validation-handoff-closure-boundary")
	);
	TestTrue(
		TEXT("The validation handoff-closure boundary must preserve benchmark-delta closure notes."),
		Boundary.ClosureNoteIds.Contains(TEXT("handoff-closure/benchmark-delta-closed"))
	);
	TestTrue(
		TEXT("The validation handoff-closure boundary must preserve the bounded handoff closure note surface."),
		Boundary.ClosureSurfaceTags.Contains(TEXT("bounded handoff closure note"))
	);
	TestTrue(
		TEXT("The validation handoff-closure boundary must preserve the no-release-readiness gate guard."),
		Boundary.ContinuityGuardTags.Contains(TEXT("no-release-readiness gate guard"))
	);
	TestTrue(
		TEXT("The validation handoff-closure boundary must keep generic case management ownership excluded."),
		Boundary.ExplicitExclusions.Contains(TEXT("generic case management ownership"))
	);
	return true;
}

#endif
