#include "HyperTwistTraining/HyperTwistTrainingRuntimeLibrary.h"

#include "Misc/AutomationTest.h"

IMPLEMENT_SIMPLE_AUTOMATION_TEST(
	FHyperTwistValidationPhaseJGAChimereStateLedgerContractTest,
	"HyperTwist.Validation.PhaseJGA.ChimereStateLedgerContract",
	EAutomationTestFlags::EditorContext | EAutomationTestFlags::EngineFilter
)

bool FHyperTwistValidationPhaseJGAChimereStateLedgerContractTest::RunTest(const FString& Parameters)
{
	FHyperTwistTrainingValidationChimereStateLedgerContract Contract;
	const bool bResolved = UHyperTwistTrainingRuntimeLibrary::TryGetBundledValidationChimereStateLedgerContract(
		TEXT("validation-chimere-state-ledger-contract"),
		Contract);

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

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

	return true;
}

IMPLEMENT_SIMPLE_AUTOMATION_TEST(
	FHyperTwistValidationPhaseJGAOngoingStateScarfBoundaryTest,
	"HyperTwist.Validation.PhaseJGA.OngoingStateScarfBoundary",
	EAutomationTestFlags::EditorContext | EAutomationTestFlags::EngineFilter
)

bool FHyperTwistValidationPhaseJGAOngoingStateScarfBoundaryTest::RunTest(const FString& Parameters)
{
	FHyperTwistTrainingValidationOngoingStateScarfBoundary Boundary;
	const bool bResolved = UHyperTwistTrainingRuntimeLibrary::TryGetBundledValidationOngoingStateScarfBoundary(
		TEXT("validation-ongoing-state-scarf-boundary"),
		Boundary);

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

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

	return true;
}
