#include "HyperTwistTraining/HyperTwistTrainingRuntimeLibrary.h"

#include "Misc/AutomationTest.h"

IMPLEMENT_SIMPLE_AUTOMATION_TEST(
	FHyperTwistValidationPhaseJHGStavrosStateLedgerContractTest,
	"HyperTwist.Validation.PhaseJHG.StavrosStateLedgerContract",
	EAutomationTestFlags::EditorContext | EAutomationTestFlags::EngineFilter
)

bool FHyperTwistValidationPhaseJHGStavrosStateLedgerContractTest::RunTest(const FString& Parameters)
{
	FHyperTwistTrainingValidationStavrosStateLedgerContract Contract;
	const bool bResolved = UHyperTwistTrainingRuntimeLibrary::TryGetBundledValidationStavrosStateLedgerContract(
		TEXT("validation-stavros-state-ledger-contract"),
		Contract);

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

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

	return true;
}

IMPLEMENT_SIMPLE_AUTOMATION_TEST(
	FHyperTwistValidationPhaseJHGOngoingStateProskynesisBoundaryTest,
	"HyperTwist.Validation.PhaseJHG.OngoingStateProskynesisBoundary",
	EAutomationTestFlags::EditorContext | EAutomationTestFlags::EngineFilter
)

bool FHyperTwistValidationPhaseJHGOngoingStateProskynesisBoundaryTest::RunTest(const FString& Parameters)
{
	FHyperTwistTrainingValidationOngoingStateProskynesisBoundary Boundary;
	const bool bResolved = UHyperTwistTrainingRuntimeLibrary::TryGetBundledValidationOngoingStateProskynesisBoundary(
		TEXT("validation-ongoing-state-proskynesis-boundary"),
		Boundary);

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

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

	return true;
}
