#include "HyperTwistTraining/HyperTwistTrainingRuntimeLibrary.h"

#include "Misc/AutomationTest.h"

IMPLEMENT_SIMPLE_AUTOMATION_TEST(
	FHyperTwistValidationPhaseJCZFasciaStateLedgerContractTest,
	"HyperTwist.Validation.PhaseJCZ.FasciaStateLedgerContract",
	EAutomationTestFlags::EditorContext | EAutomationTestFlags::EngineFilter
)

bool FHyperTwistValidationPhaseJCZFasciaStateLedgerContractTest::RunTest(const FString& Parameters)
{
	FHyperTwistTrainingValidationFasciaStateLedgerContract Contract;
	const bool bResolved = UHyperTwistTrainingRuntimeLibrary::TryGetBundledValidationFasciaStateLedgerContract(
		TEXT("validation-fascia-state-ledger-contract"),
		Contract);

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

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

	return true;
}

IMPLEMENT_SIMPLE_AUTOMATION_TEST(
	FHyperTwistValidationPhaseJCZOngoingStateExaltationBoundaryTest,
	"HyperTwist.Validation.PhaseJCZ.OngoingStateExaltationBoundary",
	EAutomationTestFlags::EditorContext | EAutomationTestFlags::EngineFilter
)

bool FHyperTwistValidationPhaseJCZOngoingStateExaltationBoundaryTest::RunTest(const FString& Parameters)
{
	FHyperTwistTrainingValidationOngoingStateExaltationBoundary Boundary;
	const bool bResolved = UHyperTwistTrainingRuntimeLibrary::TryGetBundledValidationOngoingStateExaltationBoundary(
		TEXT("validation-ongoing-state-exaltation-boundary"),
		Boundary);

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

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

	return true;
}
