#include "HyperTwistTraining/HyperTwistTrainingRuntimeLibrary.h"

#include "Misc/AutomationTest.h"

IMPLEMENT_SIMPLE_AUTOMATION_TEST(
	FHyperTwistValidationPhaseJGECappaMagnaStateLedgerContractTest,
	"HyperTwist.Validation.PhaseJGE.CappaMagnaStateLedgerContract",
	EAutomationTestFlags::EditorContext | EAutomationTestFlags::EngineFilter
)

bool FHyperTwistValidationPhaseJGECappaMagnaStateLedgerContractTest::RunTest(const FString& Parameters)
{
	FHyperTwistTrainingValidationCappaMagnaStateLedgerContract Contract;
	const bool bResolved = UHyperTwistTrainingRuntimeLibrary::TryGetBundledValidationCappaMagnaStateLedgerContract(
		TEXT("validation-cappa-magna-state-ledger-contract"),
		Contract);

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

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

	return true;
}

IMPLEMENT_SIMPLE_AUTOMATION_TEST(
	FHyperTwistValidationPhaseJGEOngoingStatePellegrinaBoundaryTest,
	"HyperTwist.Validation.PhaseJGE.OngoingStatePellegrinaBoundary",
	EAutomationTestFlags::EditorContext | EAutomationTestFlags::EngineFilter
)

bool FHyperTwistValidationPhaseJGEOngoingStatePellegrinaBoundaryTest::RunTest(const FString& Parameters)
{
	FHyperTwistTrainingValidationOngoingStatePellegrinaBoundary Boundary;
	const bool bResolved = UHyperTwistTrainingRuntimeLibrary::TryGetBundledValidationOngoingStatePellegrinaBoundary(
		TEXT("validation-ongoing-state-pellegrina-boundary"),
		Boundary);

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

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

	return true;
}
