#include "HyperTwistTraining/HyperTwistTrainingRuntimeLibrary.h"

#include "Misc/AutomationTest.h"

IMPLEMENT_SIMPLE_AUTOMATION_TEST(
	FHyperTwistValidationPhaseJEFPodiumStateLedgerContractTest,
	"HyperTwist.Validation.PhaseJEF.PodiumStateLedgerContract",
	EAutomationTestFlags::EditorContext | EAutomationTestFlags::EngineFilter
)

bool FHyperTwistValidationPhaseJEFPodiumStateLedgerContractTest::RunTest(const FString& Parameters)
{
	FHyperTwistTrainingValidationPodiumStateLedgerContract Contract;
	const bool bResolved = UHyperTwistTrainingRuntimeLibrary::TryGetBundledValidationPodiumStateLedgerContract(
		TEXT("validation-podium-state-ledger-contract"),
		Contract);

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

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

	return true;
}

IMPLEMENT_SIMPLE_AUTOMATION_TEST(
	FHyperTwistValidationPhaseJEFOngoingStateConfederationBoundaryTest,
	"HyperTwist.Validation.PhaseJEF.OngoingStateConfederationBoundary",
	EAutomationTestFlags::EditorContext | EAutomationTestFlags::EngineFilter
)

bool FHyperTwistValidationPhaseJEFOngoingStateConfederationBoundaryTest::RunTest(const FString& Parameters)
{
	FHyperTwistTrainingValidationOngoingStateConfederationBoundary Boundary;
	const bool bResolved = UHyperTwistTrainingRuntimeLibrary::TryGetBundledValidationOngoingStateConfederationBoundary(
		TEXT("validation-ongoing-state-confederation-boundary"),
		Boundary);

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

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

	return true;
}
