#include "HyperTwistTraining/HyperTwistTrainingRuntimeLibrary.h"

#include "Misc/AutomationTest.h"

IMPLEMENT_SIMPLE_AUTOMATION_TEST(
	FHyperTwistValidationPhaseJGISakkosStateLedgerContractTest,
	"HyperTwist.Validation.PhaseJGI.SakkosStateLedgerContract",
	EAutomationTestFlags::EditorContext | EAutomationTestFlags::EngineFilter
)

bool FHyperTwistValidationPhaseJGISakkosStateLedgerContractTest::RunTest(const FString& Parameters)
{
	FHyperTwistTrainingValidationSakkosStateLedgerContract Contract;
	const bool bResolved = UHyperTwistTrainingRuntimeLibrary::TryGetBundledValidationSakkosStateLedgerContract(
		TEXT("validation-sakkos-state-ledger-contract"),
		Contract);

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

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

	return true;
}

IMPLEMENT_SIMPLE_AUTOMATION_TEST(
	FHyperTwistValidationPhaseJGIOngoingStateOmophorionBoundaryTest,
	"HyperTwist.Validation.PhaseJGI.OngoingStateOmophorionBoundary",
	EAutomationTestFlags::EditorContext | EAutomationTestFlags::EngineFilter
)

bool FHyperTwistValidationPhaseJGIOngoingStateOmophorionBoundaryTest::RunTest(const FString& Parameters)
{
	FHyperTwistTrainingValidationOngoingStateOmophorionBoundary Boundary;
	const bool bResolved = UHyperTwistTrainingRuntimeLibrary::TryGetBundledValidationOngoingStateOmophorionBoundary(
		TEXT("validation-ongoing-state-omophorion-boundary"),
		Boundary);

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

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

	return true;
}
