// Copyright HyperTwist, Inc. All Rights Reserved.

#include "Misc/AutomationTest.h"

#include "HyperTwistTraining/HyperTwistTrainingRuntimeLibrary.h"

#if WITH_AUTOMATION_TESTS

IMPLEMENT_SIMPLE_AUTOMATION_TEST(
	FHyperTwistValidationPhaseJETriageQueueContractTest,
	"HyperTwist.FirstParty.Validation.PhaseJE.TriageQueues",
	EAutomationTestFlags::EditorContext | EAutomationTestFlags::EngineFilter
)

bool FHyperTwistValidationPhaseJETriageQueueContractTest::RunTest(const FString& Parameters)
{
	FHyperTwistTrainingValidationTriageQueueContract Contract;
	TestTrue(
		TEXT("The validation triage-queue contract must resolve from the runtime library."),
		UHyperTwistTrainingRuntimeLibrary::TryGetBundledValidationTriageQueueContract(
			TEXT("validation-triage-queue-contract"),
			Contract
		)
	);
	TestEqual(
		TEXT("The validation triage-queue contract id must stay stable."),
		Contract.ContractId,
		TEXT("validation-triage-queue-contract")
	);
	TestTrue(
		TEXT("The validation triage-queue contract must preserve the replay-integrity triage lane."),
		Contract.QueueLaneIds.Contains(TEXT("triage-lane/replay-integrity"))
	);
	TestTrue(
		TEXT("The validation triage-queue contract must preserve the bounded triage queue posture."),
		Contract.QueueSurfaceTags.Contains(TEXT("bounded triage queue posture"))
	);
	TestTrue(
		TEXT("The validation triage-queue contract must preserve the manual-escalation-only guard."),
		Contract.ManualEscalationGuardTags.Contains(TEXT("manual-escalation-only guard"))
	);
	TestTrue(
		TEXT("The validation triage-queue contract must keep generic queue engine ownership excluded."),
		Contract.ExplicitExclusions.Contains(TEXT("generic queue engine ownership"))
	);
	return true;
}

IMPLEMENT_SIMPLE_AUTOMATION_TEST(
	FHyperTwistValidationPhaseJEManualSignOffNoteBoundaryTest,
	"HyperTwist.FirstParty.Validation.PhaseJE.ManualSignOffNotes",
	EAutomationTestFlags::EditorContext | EAutomationTestFlags::EngineFilter
)

bool FHyperTwistValidationPhaseJEManualSignOffNoteBoundaryTest::RunTest(const FString& Parameters)
{
	FHyperTwistTrainingManualSignOffNoteBoundary Boundary;
	TestTrue(
		TEXT("The manual sign-off note boundary must resolve from the runtime library."),
		UHyperTwistTrainingRuntimeLibrary::TryGetBundledManualSignOffNoteBoundary(
			TEXT("validation-manual-signoff-note-boundary"),
			Boundary
		)
	);
	TestEqual(
		TEXT("The manual sign-off note boundary id must stay stable."),
		Boundary.BoundaryId,
		TEXT("validation-manual-signoff-note-boundary")
	);
	TestTrue(
		TEXT("The manual sign-off note boundary must preserve benchmark-delta-reviewed sign-off notes."),
		Boundary.SignOffNoteIds.Contains(TEXT("signoff-note/benchmark-delta-reviewed"))
	);
	TestTrue(
		TEXT("The manual sign-off note boundary must preserve the bounded manual sign-off note surface."),
		Boundary.SignOffSurfaceTags.Contains(TEXT("bounded manual sign-off note"))
	);
	TestTrue(
		TEXT("The manual sign-off note boundary must preserve the manual-note-only guard."),
		Boundary.ReviewIntegrityGuardTags.Contains(TEXT("manual-note-only guard"))
	);
	TestTrue(
		TEXT("The manual sign-off note boundary must keep generic approval workflow ownership excluded."),
		Boundary.ExplicitExclusions.Contains(TEXT("generic approval workflow ownership"))
	);
	return true;
}

#endif
