#include "HyperTwistTraining/HyperTwistTrainingRuntimeLibrary.h"

#include "Misc/AutomationTest.h"

IMPLEMENT_SIMPLE_AUTOMATION_TEST(
	FHyperTwistValidationPhaseJGKOrarionStateLedgerContractTest,
	"HyperTwist.Validation.PhaseJGK.OrarionStateLedgerContract",
	EAutomationTestFlags::EditorContext | EAutomationTestFlags::EngineFilter
)

bool FHyperTwistValidationPhaseJGKOrarionStateLedgerContractTest::RunTest(const FString& Parameters)
{
	FHyperTwistTrainingValidationOrarionStateLedgerContract Contract;
	const bool bResolved = UHyperTwistTrainingRuntimeLibrary::TryGetBundledValidationOrarionStateLedgerContract(
		TEXT("validation-orarion-state-ledger-contract"),
		Contract);

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

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

	return true;
}

IMPLEMENT_SIMPLE_AUTOMATION_TEST(
	FHyperTwistValidationPhaseJGKOngoingStateEpitrachelionBoundaryTest,
	"HyperTwist.Validation.PhaseJGK.OngoingStateEpitrachelionBoundary",
	EAutomationTestFlags::EditorContext | EAutomationTestFlags::EngineFilter
)

bool FHyperTwistValidationPhaseJGKOngoingStateEpitrachelionBoundaryTest::RunTest(const FString& Parameters)
{
	FHyperTwistTrainingValidationOngoingStateEpitrachelionBoundary Boundary;
	const bool bResolved = UHyperTwistTrainingRuntimeLibrary::TryGetBundledValidationOngoingStateEpitrachelionBoundary(
		TEXT("validation-ongoing-state-epitrachelion-boundary"),
		Boundary);

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

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

	return true;
}
