#include "HyperTwistTraining/HyperTwistTrainingRuntimeLibrary.h"

#include "Misc/AutomationTest.h"

IMPLEMENT_SIMPLE_AUTOMATION_TEST(
	FHyperTwistValidationPhaseJEJLecternStateLedgerContractTest,
	"HyperTwist.Validation.PhaseJEJ.LecternStateLedgerContract",
	EAutomationTestFlags::EditorContext | EAutomationTestFlags::EngineFilter
)

bool FHyperTwistValidationPhaseJEJLecternStateLedgerContractTest::RunTest(const FString& Parameters)
{
	FHyperTwistTrainingValidationLecternStateLedgerContract Contract;
	const bool bResolved = UHyperTwistTrainingRuntimeLibrary::TryGetBundledValidationLecternStateLedgerContract(
		TEXT("validation-lectern-state-ledger-contract"),
		Contract);

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

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

	return true;
}

IMPLEMENT_SIMPLE_AUTOMATION_TEST(
	FHyperTwistValidationPhaseJEJOngoingStateCouncilBoundaryTest,
	"HyperTwist.Validation.PhaseJEJ.OngoingStateCouncilBoundary",
	EAutomationTestFlags::EditorContext | EAutomationTestFlags::EngineFilter
)

bool FHyperTwistValidationPhaseJEJOngoingStateCouncilBoundaryTest::RunTest(const FString& Parameters)
{
	FHyperTwistTrainingValidationOngoingStateCouncilBoundary Boundary;
	const bool bResolved = UHyperTwistTrainingRuntimeLibrary::TryGetBundledValidationOngoingStateCouncilBoundary(
		TEXT("validation-ongoing-state-council-boundary"),
		Boundary);

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

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

	return true;
}
