#include "HyperTwistTraining/HyperTwistTrainingRuntimeLibrary.h"

#include "Misc/AutomationTest.h"

IMPLEMENT_SIMPLE_AUTOMATION_TEST(
	FHyperTwistValidationPhaseJFUManipleStateLedgerContractTest,
	"HyperTwist.Validation.PhaseJFU.ManipleStateLedgerContract",
	EAutomationTestFlags::EditorContext | EAutomationTestFlags::EngineFilter
)

bool FHyperTwistValidationPhaseJFUManipleStateLedgerContractTest::RunTest(const FString& Parameters)
{
	FHyperTwistTrainingValidationManipleStateLedgerContract Contract;
	const bool bResolved = UHyperTwistTrainingRuntimeLibrary::TryGetBundledValidationManipleStateLedgerContract(
		TEXT("validation-maniple-state-ledger-contract"),
		Contract);

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

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

	return true;
}

IMPLEMENT_SIMPLE_AUTOMATION_TEST(
	FHyperTwistValidationPhaseJFUOngoingStateFanonBoundaryTest,
	"HyperTwist.Validation.PhaseJFU.OngoingStateFanonBoundary",
	EAutomationTestFlags::EditorContext | EAutomationTestFlags::EngineFilter
)

bool FHyperTwistValidationPhaseJFUOngoingStateFanonBoundaryTest::RunTest(const FString& Parameters)
{
	FHyperTwistTrainingValidationOngoingStateFanonBoundary Boundary;
	const bool bResolved = UHyperTwistTrainingRuntimeLibrary::TryGetBundledValidationOngoingStateFanonBoundary(
		TEXT("validation-ongoing-state-fanon-boundary"),
		Boundary);

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

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

	return true;
}
