#include "HyperTwistTraining/HyperTwistTrainingRuntimeLibrary.h"

#include "Misc/AutomationTest.h"

IMPLEMENT_SIMPLE_AUTOMATION_TEST(
	FHyperTwistValidationPhaseJDNCollarinoStateLedgerContractTest,
	"HyperTwist.Validation.PhaseJDN.CollarinoStateLedgerContract",
	EAutomationTestFlags::EditorContext | EAutomationTestFlags::EngineFilter
)

bool FHyperTwistValidationPhaseJDNCollarinoStateLedgerContractTest::RunTest(const FString& Parameters)
{
	FHyperTwistTrainingValidationCollarinoStateLedgerContract Contract;
	const bool bResolved = UHyperTwistTrainingRuntimeLibrary::TryGetBundledValidationCollarinoStateLedgerContract(
		TEXT("validation-collarino-state-ledger-contract"),
		Contract);

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

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

	return true;
}

IMPLEMENT_SIMPLE_AUTOMATION_TEST(
	FHyperTwistValidationPhaseJDNOngoingStateFestivityBoundaryTest,
	"HyperTwist.Validation.PhaseJDN.OngoingStateFestivityBoundary",
	EAutomationTestFlags::EditorContext | EAutomationTestFlags::EngineFilter
)

bool FHyperTwistValidationPhaseJDNOngoingStateFestivityBoundaryTest::RunTest(const FString& Parameters)
{
	FHyperTwistTrainingValidationOngoingStateFestivityBoundary Boundary;
	const bool bResolved = UHyperTwistTrainingRuntimeLibrary::TryGetBundledValidationOngoingStateFestivityBoundary(
		TEXT("validation-ongoing-state-festivity-boundary"),
		Boundary);

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

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

	return true;
}
