#include "HyperTwistTraining/HyperTwistTrainingRuntimeLibrary.h"

#include "Misc/AutomationTest.h"

IMPLEMENT_SIMPLE_AUTOMATION_TEST(
	FHyperTwistValidationPhaseJGPKoukoulionStateLedgerContractTest,
	"HyperTwist.Validation.PhaseJGP.KoukoulionStateLedgerContract",
	EAutomationTestFlags::EditorContext | EAutomationTestFlags::EngineFilter
)

bool FHyperTwistValidationPhaseJGPKoukoulionStateLedgerContractTest::RunTest(const FString& Parameters)
{
	FHyperTwistTrainingValidationKoukoulionStateLedgerContract Contract;
	const bool bResolved = UHyperTwistTrainingRuntimeLibrary::TryGetBundledValidationKoukoulionStateLedgerContract(
		TEXT("validation-koukoulion-state-ledger-contract"),
		Contract);

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

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

	return true;
}

IMPLEMENT_SIMPLE_AUTOMATION_TEST(
	FHyperTwistValidationPhaseJGPOngoingStateParamandyasBoundaryTest,
	"HyperTwist.Validation.PhaseJGP.OngoingStateParamandyasBoundary",
	EAutomationTestFlags::EditorContext | EAutomationTestFlags::EngineFilter
)

bool FHyperTwistValidationPhaseJGPOngoingStateParamandyasBoundaryTest::RunTest(const FString& Parameters)
{
	FHyperTwistTrainingValidationOngoingStateParamandyasBoundary Boundary;
	const bool bResolved = UHyperTwistTrainingRuntimeLibrary::TryGetBundledValidationOngoingStateParamandyasBoundary(
		TEXT("validation-ongoing-state-paramandyas-boundary"),
		Boundary);

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

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

	return true;
}
