#include "HyperTwistTraining/HyperTwistTrainingRuntimeLibrary.h"

#include "Misc/AutomationTest.h"

IMPLEMENT_SIMPLE_AUTOMATION_TEST(
	FHyperTwistValidationPhaseJHLEcteniaStateLedgerContractTest,
	"HyperTwist.Validation.PhaseJHL.EcteniaStateLedgerContract",
	EAutomationTestFlags::EditorContext | EAutomationTestFlags::EngineFilter
)

bool FHyperTwistValidationPhaseJHLEcteniaStateLedgerContractTest::RunTest(const FString& Parameters)
{
	FHyperTwistTrainingValidationEcteniaStateLedgerContract Contract;
	const bool bResolved = UHyperTwistTrainingRuntimeLibrary::TryGetBundledValidationEcteniaStateLedgerContract(
		TEXT("validation-ectenia-state-ledger-contract"),
		Contract);

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

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

	return true;
}

IMPLEMENT_SIMPLE_AUTOMATION_TEST(
	FHyperTwistValidationPhaseJHLOngoingStateSynapteBoundaryTest,
	"HyperTwist.Validation.PhaseJHL.OngoingStateSynapteBoundary",
	EAutomationTestFlags::EditorContext | EAutomationTestFlags::EngineFilter
)

bool FHyperTwistValidationPhaseJHLOngoingStateSynapteBoundaryTest::RunTest(const FString& Parameters)
{
	FHyperTwistTrainingValidationOngoingStateSynapteBoundary Boundary;
	const bool bResolved = UHyperTwistTrainingRuntimeLibrary::TryGetBundledValidationOngoingStateSynapteBoundary(
		TEXT("validation-ongoing-state-synapte-boundary"),
		Boundary);

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

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

	return true;
}
