// Copyright HyperTwist, Inc. All Rights Reserved.

#include "Misc/AutomationTest.h"

#include "HyperTwistTraining/HyperTwistTrainingRuntimeLibrary.h"

#if WITH_AUTOMATION_TESTS

IMPLEMENT_SIMPLE_AUTOMATION_TEST(
	FHyperTwistValidationPhaseJJRevisitCompletionReceiptContractTest,
	"HyperTwist.FirstParty.Validation.PhaseJJ.RevisitCompletionReceipts",
	EAutomationTestFlags::EditorContext | EAutomationTestFlags::EngineFilter
)

bool FHyperTwistValidationPhaseJJRevisitCompletionReceiptContractTest::RunTest(const FString& Parameters)
{
	FHyperTwistTrainingValidationRevisitCompletionReceiptContract Contract;
	TestTrue(
		TEXT("The validation revisit-completion receipt contract must resolve from the runtime library."),
		UHyperTwistTrainingRuntimeLibrary::TryGetBundledValidationRevisitCompletionReceiptContract(
			TEXT("validation-revisit-completion-receipt-contract"),
			Contract
		)
	);
	TestEqual(
		TEXT("The validation revisit-completion receipt contract id must stay stable."),
		Contract.ContractId,
		TEXT("validation-revisit-completion-receipt-contract")
	);
	TestTrue(
		TEXT("The validation revisit-completion receipt contract must preserve benchmark drift completion receipts."),
		Contract.CompletionReceiptIds.Contains(TEXT("revisit-completion-receipt/benchmark-drift-reviewed"))
	);
	TestTrue(
		TEXT("The validation revisit-completion receipt contract must preserve the bounded revisit completion receipt surface."),
		Contract.ReceiptSurfaceTags.Contains(TEXT("bounded revisit completion receipt"))
	);
	TestTrue(
		TEXT("The validation revisit-completion receipt contract must preserve the no-generic-work-completion guard."),
		Contract.CompletionGuardTags.Contains(TEXT("no-generic-work-completion guard"))
	);
	TestTrue(
		TEXT("The validation revisit-completion receipt contract must keep generic task completion ownership excluded."),
		Contract.ExplicitExclusions.Contains(TEXT("generic task completion ownership"))
	);
	return true;
}

IMPLEMENT_SIMPLE_AUTOMATION_TEST(
	FHyperTwistValidationPhaseJJPendingStateClearanceBoundaryTest,
	"HyperTwist.FirstParty.Validation.PhaseJJ.PendingStateClearances",
	EAutomationTestFlags::EditorContext | EAutomationTestFlags::EngineFilter
)

bool FHyperTwistValidationPhaseJJPendingStateClearanceBoundaryTest::RunTest(const FString& Parameters)
{
	FHyperTwistTrainingValidationPendingStateClearanceBoundary Boundary;
	TestTrue(
		TEXT("The validation pending-state clearance boundary must resolve from the runtime library."),
		UHyperTwistTrainingRuntimeLibrary::TryGetBundledValidationPendingStateClearanceBoundary(
			TEXT("validation-pending-state-clearance-boundary"),
			Boundary
		)
	);
	TestEqual(
		TEXT("The validation pending-state clearance boundary id must stay stable."),
		Boundary.BoundaryId,
		TEXT("validation-pending-state-clearance-boundary")
	);
	TestTrue(
		TEXT("The validation pending-state clearance boundary must preserve benchmark-drift pending-clearance notes."),
		Boundary.ClearanceNoteIds.Contains(TEXT("pending-clearance/benchmark-drift-pending-cleared"))
	);
	TestTrue(
		TEXT("The validation pending-state clearance boundary must preserve the bounded pending-state clearance surface."),
		Boundary.ClearanceSurfaceTags.Contains(TEXT("bounded pending-state clearance"))
	);
	TestTrue(
		TEXT("The validation pending-state clearance boundary must preserve the no-backlog-system-ownership guard."),
		Boundary.ClearanceGuardTags.Contains(TEXT("no-backlog-system-ownership guard"))
	);
	TestTrue(
		TEXT("The validation pending-state clearance boundary must keep generic backlog ownership excluded."),
		Boundary.ExplicitExclusions.Contains(TEXT("generic backlog ownership"))
	);
	return true;
}

#endif
