#include "HyperTwistTraining/HyperTwistTrainingRuntimeLibrary.h"

#include "Misc/AutomationTest.h"

IMPLEMENT_SIMPLE_AUTOMATION_TEST(
	FHyperTwistValidationPhaseJEZPredellaStateLedgerContractTest,
	"HyperTwist.Validation.PhaseJEZ.PredellaStateLedgerContract",
	EAutomationTestFlags::EditorContext | EAutomationTestFlags::EngineFilter
)

bool FHyperTwistValidationPhaseJEZPredellaStateLedgerContractTest::RunTest(const FString& Parameters)
{
	FHyperTwistTrainingValidationPredellaStateLedgerContract Contract;
	const bool bResolved = UHyperTwistTrainingRuntimeLibrary::TryGetBundledValidationPredellaStateLedgerContract(
		TEXT("validation-predella-state-ledger-contract"),
		Contract);

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

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

	return true;
}

IMPLEMENT_SIMPLE_AUTOMATION_TEST(
	FHyperTwistValidationPhaseJEZOngoingStateDossalBoundaryTest,
	"HyperTwist.Validation.PhaseJEZ.OngoingStateDossalBoundary",
	EAutomationTestFlags::EditorContext | EAutomationTestFlags::EngineFilter
)

bool FHyperTwistValidationPhaseJEZOngoingStateDossalBoundaryTest::RunTest(const FString& Parameters)
{
	FHyperTwistTrainingValidationOngoingStateDossalBoundary Boundary;
	const bool bResolved = UHyperTwistTrainingRuntimeLibrary::TryGetBundledValidationOngoingStateDossalBoundary(
		TEXT("validation-ongoing-state-dossal-boundary"),
		Boundary);

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

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

	return true;
}
