#include "HyperTwistTraining/HyperTwistTrainingRuntimeLibrary.h"

#include "Misc/AutomationTest.h"

IMPLEMENT_SIMPLE_AUTOMATION_TEST(
	FHyperTwistValidationPhaseJGREpanorionStateLedgerContractTest,
	"HyperTwist.Validation.PhaseJGR.EpanorionStateLedgerContract",
	EAutomationTestFlags::EditorContext | EAutomationTestFlags::EngineFilter
)

bool FHyperTwistValidationPhaseJGREpanorionStateLedgerContractTest::RunTest(const FString& Parameters)
{
	FHyperTwistTrainingValidationEpanorionStateLedgerContract Contract;
	const bool bResolved = UHyperTwistTrainingRuntimeLibrary::TryGetBundledValidationEpanorionStateLedgerContract(
		TEXT("validation-epanorion-state-ledger-contract"),
		Contract);

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

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

	return true;
}

IMPLEMENT_SIMPLE_AUTOMATION_TEST(
	FHyperTwistValidationPhaseJGROngoingStateEpirrhiptarionBoundaryTest,
	"HyperTwist.Validation.PhaseJGR.OngoingStateEpirrhiptarionBoundary",
	EAutomationTestFlags::EditorContext | EAutomationTestFlags::EngineFilter
)

bool FHyperTwistValidationPhaseJGROngoingStateEpirrhiptarionBoundaryTest::RunTest(const FString& Parameters)
{
	FHyperTwistTrainingValidationOngoingStateEpirrhiptarionBoundary Boundary;
	const bool bResolved = UHyperTwistTrainingRuntimeLibrary::TryGetBundledValidationOngoingStateEpirrhiptarionBoundary(
		TEXT("validation-ongoing-state-epirrhiptarion-boundary"),
		Boundary);

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

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

	return true;
}
