// Copyright HyperTwist, Inc. All Rights Reserved.

#include "Misc/AutomationTest.h"

#include "HyperTwistTraining/HyperTwistTrainingRuntimeLibrary.h"

#if WITH_AUTOMATION_TESTS

IMPLEMENT_SIMPLE_AUTOMATION_TEST(
	FHyperTwistValidationPhaseJHDispositionSnapshotContractTest,
	"HyperTwist.FirstParty.Validation.PhaseJH.DispositionSnapshots",
	EAutomationTestFlags::EditorContext | EAutomationTestFlags::EngineFilter
)

bool FHyperTwistValidationPhaseJHDispositionSnapshotContractTest::RunTest(const FString& Parameters)
{
	FHyperTwistTrainingValidationDispositionSnapshotContract Contract;
	TestTrue(
		TEXT("The validation disposition-snapshot contract must resolve from the runtime library."),
		UHyperTwistTrainingRuntimeLibrary::TryGetBundledValidationDispositionSnapshotContract(
			TEXT("validation-disposition-snapshot-contract"),
			Contract
		)
	);
	TestEqual(
		TEXT("The validation disposition-snapshot contract id must stay stable."),
		Contract.ContractId,
		TEXT("validation-disposition-snapshot-contract")
	);
	TestTrue(
		TEXT("The validation disposition-snapshot contract must preserve reopen-required snapshots."),
		Contract.DispositionSnapshotIds.Contains(TEXT("disposition-snapshot/reopen-required"))
	);
	TestTrue(
		TEXT("The validation disposition-snapshot contract must preserve the bounded validation disposition snapshot surface."),
		Contract.SnapshotSurfaceTags.Contains(TEXT("bounded validation disposition snapshot"))
	);
	TestTrue(
		TEXT("The validation disposition-snapshot contract must preserve the no-issue-tracker-disposition guard."),
		Contract.ReopenGuardTags.Contains(TEXT("no-issue-tracker-disposition guard"))
	);
	TestTrue(
		TEXT("The validation disposition-snapshot contract must keep generic issue disposition ownership excluded."),
		Contract.ExplicitExclusions.Contains(TEXT("generic issue disposition ownership"))
	);
	return true;
}

IMPLEMENT_SIMPLE_AUTOMATION_TEST(
	FHyperTwistValidationPhaseJHReopenNoteBoundaryTest,
	"HyperTwist.FirstParty.Validation.PhaseJH.ReopenNotes",
	EAutomationTestFlags::EditorContext | EAutomationTestFlags::EngineFilter
)

bool FHyperTwistValidationPhaseJHReopenNoteBoundaryTest::RunTest(const FString& Parameters)
{
	FHyperTwistTrainingValidationReopenNoteBoundary Boundary;
	TestTrue(
		TEXT("The validation reopen-note boundary must resolve from the runtime library."),
		UHyperTwistTrainingRuntimeLibrary::TryGetBundledValidationReopenNoteBoundary(
			TEXT("validation-reopen-note-boundary"),
			Boundary
		)
	);
	TestEqual(
		TEXT("The validation reopen-note boundary id must stay stable."),
		Boundary.BoundaryId,
		TEXT("validation-reopen-note-boundary")
	);
	TestTrue(
		TEXT("The validation reopen-note boundary must preserve benchmark drift recheck notes."),
		Boundary.ReopenNoteIds.Contains(TEXT("reopen-note/benchmark-drift-recheck"))
	);
	TestTrue(
		TEXT("The validation reopen-note boundary must preserve the bounded validation reopen note surface."),
		Boundary.ReopenSurfaceTags.Contains(TEXT("bounded validation reopen note"))
	);
	TestTrue(
		TEXT("The validation reopen-note boundary must preserve the no-generic-reopen-workflow guard."),
		Boundary.ReopenScopeGuardTags.Contains(TEXT("no-generic-reopen-workflow guard"))
	);
	TestTrue(
		TEXT("The validation reopen-note boundary must keep generic reopen workflow ownership excluded."),
		Boundary.ExplicitExclusions.Contains(TEXT("generic reopen workflow ownership"))
	);
	return true;
}

#endif
