#include "HyperTwistTraining/HyperTwistTrainingRuntimeLibrary.h"

#include "Misc/AutomationTest.h"

IMPLEMENT_SIMPLE_AUTOMATION_TEST(
	FHyperTwistValidationPhaseJDFScotiaStateLedgerContractTest,
	"HyperTwist.Validation.PhaseJDF.ScotiaStateLedgerContract",
	EAutomationTestFlags::EditorContext | EAutomationTestFlags::EngineFilter
)

bool FHyperTwistValidationPhaseJDFScotiaStateLedgerContractTest::RunTest(const FString& Parameters)
{
	FHyperTwistTrainingValidationScotiaStateLedgerContract Contract;
	const bool bResolved = UHyperTwistTrainingRuntimeLibrary::TryGetBundledValidationScotiaStateLedgerContract(
		TEXT("validation-scotia-state-ledger-contract"),
		Contract);

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

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

	return true;
}

IMPLEMENT_SIMPLE_AUTOMATION_TEST(
	FHyperTwistValidationPhaseJDFOngoingStateElationBoundaryTest,
	"HyperTwist.Validation.PhaseJDF.OngoingStateElationBoundary",
	EAutomationTestFlags::EditorContext | EAutomationTestFlags::EngineFilter
)

bool FHyperTwistValidationPhaseJDFOngoingStateElationBoundaryTest::RunTest(const FString& Parameters)
{
	FHyperTwistTrainingValidationOngoingStateElationBoundary Boundary;
	const bool bResolved = UHyperTwistTrainingRuntimeLibrary::TryGetBundledValidationOngoingStateElationBoundary(
		TEXT("validation-ongoing-state-elation-boundary"),
		Boundary);

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

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

	return true;
}
