#include "HyperTwistTraining/HyperTwistTrainingRuntimeLibrary.h"

#include "Misc/AutomationTest.h"

IMPLEMENT_SIMPLE_AUTOMATION_TEST(
	FHyperTwistValidationPhaseJFHThuribleStateLedgerContractTest,
	"HyperTwist.Validation.PhaseJFH.ThuribleStateLedgerContract",
	EAutomationTestFlags::EditorContext | EAutomationTestFlags::EngineFilter
)

bool FHyperTwistValidationPhaseJFHThuribleStateLedgerContractTest::RunTest(const FString& Parameters)
{
	FHyperTwistTrainingValidationThuribleStateLedgerContract Contract;
	const bool bResolved = UHyperTwistTrainingRuntimeLibrary::TryGetBundledValidationThuribleStateLedgerContract(
		TEXT("validation-thurible-state-ledger-contract"),
		Contract);

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

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

	return true;
}

IMPLEMENT_SIMPLE_AUTOMATION_TEST(
	FHyperTwistValidationPhaseJFHOngoingStateNaviculaBoundaryTest,
	"HyperTwist.Validation.PhaseJFH.OngoingStateNaviculaBoundary",
	EAutomationTestFlags::EditorContext | EAutomationTestFlags::EngineFilter
)

bool FHyperTwistValidationPhaseJFHOngoingStateNaviculaBoundaryTest::RunTest(const FString& Parameters)
{
	FHyperTwistTrainingValidationOngoingStateNaviculaBoundary Boundary;
	const bool bResolved = UHyperTwistTrainingRuntimeLibrary::TryGetBundledValidationOngoingStateNaviculaBoundary(
		TEXT("validation-ongoing-state-navicula-boundary"),
		Boundary);

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

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

	return true;
}
