#include "HyperTwistTraining/HyperTwistTrainingRuntimeLibrary.h"

#include "Misc/AutomationTest.h"

IMPLEMENT_SIMPLE_AUTOMATION_TEST(
	FHyperTwistValidationPhaseJFNLunetteStateLedgerContractTest,
	"HyperTwist.Validation.PhaseJFN.LunetteStateLedgerContract",
	EAutomationTestFlags::EditorContext | EAutomationTestFlags::EngineFilter
)

bool FHyperTwistValidationPhaseJFNLunetteStateLedgerContractTest::RunTest(const FString& Parameters)
{
	FHyperTwistTrainingValidationLunetteStateLedgerContract Contract;
	const bool bResolved = UHyperTwistTrainingRuntimeLibrary::TryGetBundledValidationLunetteStateLedgerContract(
		TEXT("validation-lunette-state-ledger-contract"),
		Contract);

	TestTrue(
		TEXT("The validation lunette-state ledger contract must resolve from the runtime library."),
		bResolved);
	if (!bResolved)
	{
		return false;
	}

	TestEqual(
		TEXT("The validation lunette-state ledger contract id must stay stable."),
		Contract.ContractId,
		FString(TEXT("validation-lunette-state-ledger-contract")));
	TestTrue(
		TEXT("The validation lunette-state ledger contract must preserve benchmark-drift lunette ledgers."),
		Contract.LedgerIds.Contains(TEXT("lunette-state-ledger/benchmark-drift-lunette")));
	TestTrue(
		TEXT("The validation lunette-state ledger contract must preserve the bounded lunette-state ledger surface."),
		Contract.LedgerSurfaceTags.Contains(TEXT("bounded lunette-state ledger")));
	TestTrue(
		TEXT("The validation lunette-state ledger contract must preserve the no-generic-lunette-state-platform guard."),
		Contract.LunetteGuardTags.Contains(TEXT("no-generic-lunette-state-platform guard")));
	TestTrue(
		TEXT("The validation lunette-state ledger contract must keep generic lunette-state platform ownership excluded."),
		Contract.ExplicitExclusions.Contains(TEXT("generic lunette-state platform ownership")));

	return true;
}

IMPLEMENT_SIMPLE_AUTOMATION_TEST(
	FHyperTwistValidationPhaseJFNOngoingStateHumeralVeilBoundaryTest,
	"HyperTwist.Validation.PhaseJFN.OngoingStateHumeralVeilBoundary",
	EAutomationTestFlags::EditorContext | EAutomationTestFlags::EngineFilter
)

bool FHyperTwistValidationPhaseJFNOngoingStateHumeralVeilBoundaryTest::RunTest(const FString& Parameters)
{
	FHyperTwistTrainingValidationOngoingStateHumeralVeilBoundary Boundary;
	const bool bResolved = UHyperTwistTrainingRuntimeLibrary::TryGetBundledValidationOngoingStateHumeralVeilBoundary(
		TEXT("validation-ongoing-state-humeral-veil-boundary"),
		Boundary);

	TestTrue(
		TEXT("The validation ongoing-state humeral-veil boundary must resolve from the runtime library."),
		bResolved);
	if (!bResolved)
	{
		return false;
	}

	TestEqual(
		TEXT("The validation ongoing-state humeral-veil boundary id must stay stable."),
		Boundary.BoundaryId,
		FString(TEXT("validation-ongoing-state-humeral-veil-boundary")));
	TestTrue(
		TEXT("The validation ongoing-state humeral-veil boundary must preserve manual-waiver humeral-veil anchors."),
		Boundary.HumeralVeilIds.Contains(TEXT("ongoing-humeral-veil/manual-waiver-humeral-veil")));
	TestTrue(
		TEXT("The validation ongoing-state humeral-veil boundary must preserve the bounded ongoing-state humeral-veil surface."),
		Boundary.HumeralVeilSurfaceTags.Contains(TEXT("bounded ongoing-state humeral-veil")));
	TestTrue(
		TEXT("The validation ongoing-state humeral-veil boundary must preserve the no-generic-ongoing-humeral-veil-platform guard."),
		Boundary.HumeralVeilGuardTags.Contains(TEXT("no-generic-ongoing-humeral-veil-platform guard")));
	TestTrue(
		TEXT("The validation ongoing-state humeral-veil boundary must keep generic ongoing humeral-veil platform ownership excluded."),
		Boundary.ExplicitExclusions.Contains(TEXT("generic ongoing humeral-veil platform ownership")));

	return true;
}
