#include "HyperTwistTraining/HyperTwistTrainingRuntimeLibrary.h"

#include "Misc/AutomationTest.h"

IMPLEMENT_SIMPLE_AUTOMATION_TEST(
	FHyperTwistValidationPhaseJETNaveStateLedgerContractTest,
	"HyperTwist.Validation.PhaseJET.NaveStateLedgerContract",
	EAutomationTestFlags::EditorContext | EAutomationTestFlags::EngineFilter
)

bool FHyperTwistValidationPhaseJETNaveStateLedgerContractTest::RunTest(const FString& Parameters)
{
	FHyperTwistTrainingValidationNaveStateLedgerContract Contract;
	const bool bResolved = UHyperTwistTrainingRuntimeLibrary::TryGetBundledValidationNaveStateLedgerContract(
		TEXT("validation-nave-state-ledger-contract"),
		Contract);

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

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

	return true;
}

IMPLEMENT_SIMPLE_AUTOMATION_TEST(
	FHyperTwistValidationPhaseJETOngoingStateTranseptBoundaryTest,
	"HyperTwist.Validation.PhaseJET.OngoingStateTranseptBoundary",
	EAutomationTestFlags::EditorContext | EAutomationTestFlags::EngineFilter
)

bool FHyperTwistValidationPhaseJETOngoingStateTranseptBoundaryTest::RunTest(const FString& Parameters)
{
	FHyperTwistTrainingValidationOngoingStateTranseptBoundary Boundary;
	const bool bResolved = UHyperTwistTrainingRuntimeLibrary::TryGetBundledValidationOngoingStateTranseptBoundary(
		TEXT("validation-ongoing-state-transept-boundary"),
		Boundary);

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

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

	return true;
}
