#include "HyperTwistTraining/HyperTwistTrainingRuntimeLibrary.h"

#include "Misc/AutomationTest.h"

IMPLEMENT_SIMPLE_AUTOMATION_TEST(
	FHyperTwistValidationPhaseJHMProkeimenonStateLedgerContractTest,
	"HyperTwist.Validation.PhaseJHM.ProkeimenonStateLedgerContract",
	EAutomationTestFlags::EditorContext | EAutomationTestFlags::EngineFilter
)

bool FHyperTwistValidationPhaseJHMProkeimenonStateLedgerContractTest::RunTest(const FString& Parameters)
{
	FHyperTwistTrainingValidationProkeimenonStateLedgerContract Contract;
	const bool bResolved = UHyperTwistTrainingRuntimeLibrary::TryGetBundledValidationProkeimenonStateLedgerContract(
		TEXT("validation-prokeimenon-state-ledger-contract"),
		Contract);

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

	TestEqual(
		TEXT("The validation prokeimenon-state ledger contract id must stay stable."),
		Contract.ContractId,
		FString(TEXT("validation-prokeimenon-state-ledger-contract")));
	TestTrue(
		TEXT("The validation prokeimenon-state ledger contract must be structurally valid."),
		Contract.IsStructurallyValid());
	TestTrue(
		TEXT("The validation prokeimenon-state ledger contract must carry first-party source attribution."),
		Contract.SourceAttribution.IsStructurallyValid());
	TestTrue(
		TEXT("The validation prokeimenon-state ledger contract must carry at least one ledger id."),
		Contract.LedgerIds.Num() > 0);
	TestTrue(
		TEXT("The validation prokeimenon-state ledger contract must carry at least one guard tag."),
		Contract.ProkeimenonGuardTags.Num() > 0);
	TestTrue(
		TEXT("The validation prokeimenon-state ledger contract must carry at least one explicit exclusion."),
		Contract.ExplicitExclusions.Num() > 0);

	return true;
}

IMPLEMENT_SIMPLE_AUTOMATION_TEST(
	FHyperTwistValidationPhaseJHMOngoingStateAlleluiaBoundaryTest,
	"HyperTwist.Validation.PhaseJHM.OngoingStateAlleluiaBoundary",
	EAutomationTestFlags::EditorContext | EAutomationTestFlags::EngineFilter
)

bool FHyperTwistValidationPhaseJHMOngoingStateAlleluiaBoundaryTest::RunTest(const FString& Parameters)
{
	FHyperTwistTrainingValidationOngoingStateAlleluiaBoundary Boundary;
	const bool bResolved = UHyperTwistTrainingRuntimeLibrary::TryGetBundledValidationOngoingStateAlleluiaBoundary(
		TEXT("validation-ongoing-state-alleluia-boundary"),
		Boundary);

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

	TestEqual(
		TEXT("The validation ongoing-state alleluia boundary id must stay stable."),
		Boundary.BoundaryId,
		FString(TEXT("validation-ongoing-state-alleluia-boundary")));
	TestTrue(
		TEXT("The validation ongoing-state alleluia boundary must be structurally valid."),
		Boundary.IsStructurallyValid());
	TestTrue(
		TEXT("The validation ongoing-state alleluia boundary must carry first-party source attribution."),
		Boundary.SourceAttribution.IsStructurallyValid());
	TestTrue(
		TEXT("The validation ongoing-state alleluia boundary must carry at least one alleluia id."),
		Boundary.AlleluiaIds.Num() > 0);
	TestTrue(
		TEXT("The validation ongoing-state alleluia boundary must carry at least one guard tag."),
		Boundary.AlleluiaGuardTags.Num() > 0);
	TestTrue(
		TEXT("The validation ongoing-state alleluia boundary must carry at least one explicit exclusion."),
		Boundary.ExplicitExclusions.Num() > 0);

	return true;
}
