#include "HyperTwistTraining/HyperTwistTrainingRuntimeLibrary.h"

#include "Misc/AutomationTest.h"

IMPLEMENT_SIMPLE_AUTOMATION_TEST(
	FHyperTwistValidationPhaseJFJStoupStateLedgerContractTest,
	"HyperTwist.Validation.PhaseJFJ.StoupStateLedgerContract",
	EAutomationTestFlags::EditorContext | EAutomationTestFlags::EngineFilter
)

bool FHyperTwistValidationPhaseJFJStoupStateLedgerContractTest::RunTest(const FString& Parameters)
{
	FHyperTwistTrainingValidationStoupStateLedgerContract Contract;
	const bool bResolved = UHyperTwistTrainingRuntimeLibrary::TryGetBundledValidationStoupStateLedgerContract(
		TEXT("validation-stoup-state-ledger-contract"),
		Contract);

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

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

	return true;
}

IMPLEMENT_SIMPLE_AUTOMATION_TEST(
	FHyperTwistValidationPhaseJFJOngoingStateFontBoundaryTest,
	"HyperTwist.Validation.PhaseJFJ.OngoingStateFontBoundary",
	EAutomationTestFlags::EditorContext | EAutomationTestFlags::EngineFilter
)

bool FHyperTwistValidationPhaseJFJOngoingStateFontBoundaryTest::RunTest(const FString& Parameters)
{
	FHyperTwistTrainingValidationOngoingStateFontBoundary Boundary;
	const bool bResolved = UHyperTwistTrainingRuntimeLibrary::TryGetBundledValidationOngoingStateFontBoundary(
		TEXT("validation-ongoing-state-font-boundary"),
		Boundary);

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

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

	return true;
}
