#include "HyperTwistTraining/HyperTwistTrainingRuntimeLibrary.h"

#include "Misc/AutomationTest.h"

IMPLEMENT_SIMPLE_AUTOMATION_TEST(
	FHyperTwistValidationPhaseJGOKamelavkionStateLedgerContractTest,
	"HyperTwist.Validation.PhaseJGO.KamelavkionStateLedgerContract",
	EAutomationTestFlags::EditorContext | EAutomationTestFlags::EngineFilter
)

bool FHyperTwistValidationPhaseJGOKamelavkionStateLedgerContractTest::RunTest(const FString& Parameters)
{
	FHyperTwistTrainingValidationKamelavkionStateLedgerContract Contract;
	const bool bResolved = UHyperTwistTrainingRuntimeLibrary::TryGetBundledValidationKamelavkionStateLedgerContract(
		TEXT("validation-kamelavkion-state-ledger-contract"),
		Contract);

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

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

	return true;
}

IMPLEMENT_SIMPLE_AUTOMATION_TEST(
	FHyperTwistValidationPhaseJGOOngoingStateEpanokamelavkionBoundaryTest,
	"HyperTwist.Validation.PhaseJGO.OngoingStateEpanokamelavkionBoundary",
	EAutomationTestFlags::EditorContext | EAutomationTestFlags::EngineFilter
)

bool FHyperTwistValidationPhaseJGOOngoingStateEpanokamelavkionBoundaryTest::RunTest(const FString& Parameters)
{
	FHyperTwistTrainingValidationOngoingStateEpanokamelavkionBoundary Boundary;
	const bool bResolved = UHyperTwistTrainingRuntimeLibrary::TryGetBundledValidationOngoingStateEpanokamelavkionBoundary(
		TEXT("validation-ongoing-state-epanokamelavkion-boundary"),
		Boundary);

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

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

	return true;
}
