#include "HyperTwistTraining/HyperTwistTrainingRuntimeLibrary.h"

#include "Misc/AutomationTest.h"

IMPLEMENT_SIMPLE_AUTOMATION_TEST(
	FHyperTwistValidationPhaseJFDPurificatorStateLedgerContractTest,
	"HyperTwist.Validation.PhaseJFD.PurificatorStateLedgerContract",
	EAutomationTestFlags::EditorContext | EAutomationTestFlags::EngineFilter
)

bool FHyperTwistValidationPhaseJFDPurificatorStateLedgerContractTest::RunTest(const FString& Parameters)
{
	FHyperTwistTrainingValidationPurificatorStateLedgerContract Contract;
	const bool bResolved = UHyperTwistTrainingRuntimeLibrary::TryGetBundledValidationPurificatorStateLedgerContract(
		TEXT("validation-purificator-state-ledger-contract"),
		Contract);

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

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

	return true;
}

IMPLEMENT_SIMPLE_AUTOMATION_TEST(
	FHyperTwistValidationPhaseJFDOngoingStateChaliceVeilBoundaryTest,
	"HyperTwist.Validation.PhaseJFD.OngoingStateChaliceVeilBoundary",
	EAutomationTestFlags::EditorContext | EAutomationTestFlags::EngineFilter
)

bool FHyperTwistValidationPhaseJFDOngoingStateChaliceVeilBoundaryTest::RunTest(const FString& Parameters)
{
	FHyperTwistTrainingValidationOngoingStateChaliceVeilBoundary Boundary;
	const bool bResolved = UHyperTwistTrainingRuntimeLibrary::TryGetBundledValidationOngoingStateChaliceVeilBoundary(
		TEXT("validation-ongoing-state-chalice-veil-boundary"),
		Boundary);

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

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

	return true;
}
